mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-13 08:01:33 +01:00
Lock cref before calling method that assumes lock.
This commit is contained in:
parent
2a569df97f
commit
95a70862be
1 changed files with 12 additions and 4 deletions
|
@ -143,9 +143,17 @@ CRefMgr::FindOpenGameFor( const char* cookie, const char* connName,
|
|||
if ( 0 == strcmp( cref->Cookie(), cookie ) ) {
|
||||
if ( cref->NeverFullyConnected() ) {
|
||||
found = cref;
|
||||
} else if ( cref->HasSocket(socket) ) {
|
||||
logf( XW_LOGINFO, "%s: HasSocket case", __func__ );
|
||||
found = cref;
|
||||
} else {
|
||||
if ( cref->Lock() ) {
|
||||
if ( cref->AcceptingReconnections( hid, cookie,
|
||||
nPlayersH ) ) {
|
||||
found = cref;
|
||||
} else if ( cref->HasSocket_locked(socket) ) {
|
||||
logf( XW_LOGINFO, "%s: HasSocket case", __func__);
|
||||
found = cref;
|
||||
}
|
||||
cref->Unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -399,7 +407,7 @@ CRefMgr::heartbeatProc( void* closure )
|
|||
CookieRef*
|
||||
CRefMgr::AddNew( const char* cookie, const char* connName, CookieID id )
|
||||
{
|
||||
logf( XW_LOGINFO, "%s( cookie=%s, connName=%s, id=%d", __func__,
|
||||
logf( XW_LOGINFO, "%s( cookie=%s, connName=%s, cid=%d)", __func__,
|
||||
cookie, connName, id );
|
||||
|
||||
CookieRef* ref = getFromFreeList();
|
||||
|
|
Loading…
Reference in a new issue