mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-20 22:26:54 +01:00
guard server_do against reentrance
This commit is contained in:
parent
da73f5ea9b
commit
b0d8d0baec
1 changed files with 8 additions and 1 deletions
|
@ -112,7 +112,7 @@ struct ServerCtxt {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ServerPlayer players[MAX_NUM_PLAYERS];
|
ServerPlayer players[MAX_NUM_PLAYERS];
|
||||||
|
XP_Bool serverDoing;
|
||||||
MPSLOT
|
MPSLOT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -716,6 +716,11 @@ server_do( ServerCtxt* server )
|
||||||
XP_Bool result = XP_TRUE;
|
XP_Bool result = XP_TRUE;
|
||||||
XP_Bool moreToDo = XP_FALSE;
|
XP_Bool moreToDo = XP_FALSE;
|
||||||
|
|
||||||
|
if ( server->serverDoing ) {
|
||||||
|
return XP_FALSE;
|
||||||
|
}
|
||||||
|
server->serverDoing = XP_TRUE;
|
||||||
|
|
||||||
switch( server->nv.gameState ) {
|
switch( server->nv.gameState ) {
|
||||||
case XWSTATE_BEGIN:
|
case XWSTATE_BEGIN:
|
||||||
if ( server->nv.pendingRegistrations == 0 ) { /* all players on device */
|
if ( server->nv.pendingRegistrations == 0 ) { /* all players on device */
|
||||||
|
@ -776,6 +781,8 @@ server_do( ServerCtxt* server )
|
||||||
if ( moreToDo ) {
|
if ( moreToDo ) {
|
||||||
util_requestTime( server->vol.util );
|
util_requestTime( server->vol.util );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
server->serverDoing = XP_FALSE;
|
||||||
return result;
|
return result;
|
||||||
} /* server_do */
|
} /* server_do */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue