Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
Open Virtual Carcassonne Clone
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
ovcc
Open Virtual Carcassonne Clone
Commits
254e8562
Commit
254e8562
authored
Apr 22, 2019
by
Jonathan Michalon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix deadlock when client tries to join a table and it fails
parent
04cdeb3b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
4 deletions
+22
-4
libovccclient/src/ovccclient-client.vala
libovccclient/src/ovccclient-client.vala
+1
-1
libovccclient/src/ovccclient-server.vala
libovccclient/src/ovccclient-server.vala
+11
-0
server/src/server.vala
server/src/server.vala
+10
-3
No files found.
libovccclient/src/ovccclient-client.vala
View file @
254e8562
...
...
@@ -145,7 +145,7 @@ namespace OVCCClient
/**
* Joins a table asynchronously
*
* @param index The index of the table to join
* @param index The index of the table to join
, -1 means any open table
* @param cancellable a Cancellable object or null
* @return The game corresponding to that table
*/
...
...
libovccclient/src/ovccclient-server.vala
View file @
254e8562
...
...
@@ -475,6 +475,17 @@ namespace OVCCClient
/* call the server */
yield
send_message
(
new
JoinMessage
(
index
),
cancellable
);
/* wait for answer */
Message
msg
=
yield
receive_type
(
MessageType
.
JOIN
,
cancellable
);
JoinMessage
join
=
msg
as
JoinMessage
;
if
(
join
.
status
!=
JoinMessage
.
State
.
OK
)
{
if
(
index
==
-
1
)
{
throw
new
ServerError
.
NO_OPEN_TABLE
(
"Server said that no open table is available"
);
}
else
{
throw
new
ServerError
.
NO_OPEN_TABLE
(
"Server said that the table is not open"
);
}
}
/* wait for data */
Message
msg2
=
yield
receive_type
(
MessageType
.
GAMEDATA
,
cancellable
);
GamedataMessage
data
=
msg2
as
GamedataMessage
;
...
...
server/src/server.vala
View file @
254e8562
...
...
@@ -137,16 +137,23 @@ public class Server: ThreadedSocketService
private
bool
handle_join
(
JoinMessage
msg
,
Client
client
)
throws
Error
{
/* FIXME handle precise table joins (not only -1/any) */
Game
?
table
=
pick_open_table
();
if
(
table
==
null
)
{
warning
(
"A player tried to join, but there is no open table. "
+
"We should tell her, but we just do nothing yet. "
+
"She's pretty much fucked."
);
var
join
=
new
JoinMessage
(
msg
.
table_index
);
join
.
status
=
JoinMessage
.
State
.
FAILED
;
client
.
send
(
join
);
return
false
;
}
debug
(
"Accepting table join"
);
var
join
=
new
JoinMessage
(
msg
.
table_index
);
join
.
status
=
JoinMessage
.
State
.
OK
;
client
.
send
(
join
);
client
.
join
(
table
);
debug
(
"Sending game data"
);
var
data
=
new
GamedataMessage
(
client
.
game
.
get_stack_ids
(),
client
.
game
.
get_player_nicks
(),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment