mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-26 07:58:52 +01:00
log when dropping message that would mess up cref player counts
This commit is contained in:
parent
73980a3c50
commit
f05bfcb3d8
1 changed files with 14 additions and 4 deletions
|
@ -759,14 +759,21 @@ CookieRef::increasePlayerCounts( const CRefEvent* evt, bool reconn )
|
|||
if ( reconn ) {
|
||||
if ( nPlayersS > 0 ) {
|
||||
if ( 0 != m_nPlayersSought ) {
|
||||
logf( XW_LOGERROR,
|
||||
"already have m_nPlayersSought: %d but new value %d",
|
||||
m_nPlayersSought, nPlayersS );
|
||||
goto drop;
|
||||
}
|
||||
m_nPlayersSought = nPlayersS;
|
||||
}
|
||||
m_nPlayersHere += nPlayersH;
|
||||
if ( 0 != m_nPlayersSought && m_nPlayersHere > m_nPlayersSought ) {
|
||||
if ( 0 != m_nPlayersSought &&
|
||||
m_nPlayersHere + nPlayersH > m_nPlayersSought ) {
|
||||
logf( XW_LOGERROR, "too many new players provided: %d > %d",
|
||||
m_nPlayersHere + nPlayersH, m_nPlayersSought );
|
||||
goto drop;
|
||||
}
|
||||
|
||||
m_nPlayersHere += nPlayersH;
|
||||
if ( m_nPlayersHere == m_nPlayersSought ) {
|
||||
newevt.type = XWE_ALLHERE;
|
||||
} else {
|
||||
|
@ -774,8 +781,11 @@ CookieRef::increasePlayerCounts( const CRefEvent* evt, bool reconn )
|
|||
}
|
||||
addHost = true;
|
||||
} else if ( nPlayersS > 0 ) { /* a host; init values */
|
||||
assert( m_nPlayersSought == 0 );
|
||||
assert( m_nPlayersHere == 0 );
|
||||
if ( m_nPlayersSought != 0 || m_nPlayersHere != 0 ) {
|
||||
logf( XW_LOGERROR, "cref in bad state: m_nPlayersSought: %d; "
|
||||
"m_nPlayersHere: %d", m_nPlayersSought, m_nPlayersHere );
|
||||
goto drop;
|
||||
}
|
||||
m_nPlayersHere = nPlayersH;
|
||||
m_nPlayersSought = nPlayersS;
|
||||
addHost = true;
|
||||
|
|
Loading…
Add table
Reference in a new issue