mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-29 08:34:37 +01:00
remove assertion when message mis-delivered
I don't know why, but in my tests the relay seems to be delivering messages to the wrong device. The linux device detects this. It used to assert, but now just drops the message. If this is happening on Android it might be why I'm seeing crashes...
This commit is contained in:
parent
61a1ddae69
commit
b81bd46645
4 changed files with 17 additions and 11 deletions
|
@ -231,7 +231,8 @@ pool_containsTiles( const PoolContext* pool, const TrayTileSet* tiles )
|
|||
XP_U16
|
||||
pool_getNTilesLeft( const PoolContext* pool )
|
||||
{
|
||||
return pool->numTilesLeft;
|
||||
XP_ASSERT( !!pool );
|
||||
return NULL == pool ? 0 : pool->numTilesLeft;
|
||||
} /* pool_remainingTileCount */
|
||||
|
||||
XP_U16
|
||||
|
|
|
@ -640,16 +640,21 @@ findOrOpen( CursesBoardState* cbState, sqlite3_int64 rowid,
|
|||
return result;
|
||||
}
|
||||
|
||||
XP_U16
|
||||
cb_feedRow( CursesBoardState* cbState, sqlite3_int64 rowid,
|
||||
bool
|
||||
cb_feedRow( CursesBoardState* cbState, sqlite3_int64 rowid, XP_U16 expectSeed,
|
||||
const XP_U8* buf, XP_U16 len, const CommsAddrRec* from )
|
||||
{
|
||||
LOG_FUNC();
|
||||
CursesBoardGlobals* bGlobals = findOrOpen( cbState, rowid, NULL, NULL );
|
||||
CommonGlobals* cGlobals = &bGlobals->cGlobals;
|
||||
gameGotBuf( cGlobals, XP_TRUE, buf, len, from );
|
||||
XP_U16 seed = comms_getChannelSeed( cGlobals->game.comms );
|
||||
return seed;
|
||||
bool success = 0 == expectSeed || seed == expectSeed;
|
||||
if ( success ) {
|
||||
gameGotBuf( cGlobals, XP_TRUE, buf, len, from );
|
||||
} else {
|
||||
XP_LOGFF( "msg for seed %d but I opened %d", expectSeed, seed );
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -663,7 +668,8 @@ cb_feedGame( CursesBoardState* cbState, XP_U32 gameID,
|
|||
getRowsForGameID( params->pDb, gameID, rowids, &nRows );
|
||||
XP_LOGF( "%s(): found %d rows for gameID %d", __func__, nRows, gameID );
|
||||
for ( int ii = 0; ii < nRows; ++ii ) {
|
||||
(void)cb_feedRow( cbState, rowids[ii], buf, len, from );
|
||||
bool success = cb_feedRow( cbState, rowids[ii], 0, buf, len, from );
|
||||
XP_ASSERT( success );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,8 +44,9 @@ bool cb_new( CursesBoardState* cbState, const cb_dims* dims );
|
|||
void cb_newFor( CursesBoardState* cbState, const NetLaunchInfo* nli,
|
||||
const CommsAddrRec* returnAddr, const cb_dims* dims );
|
||||
|
||||
XP_U16 cb_feedRow( CursesBoardState* cbState, sqlite3_int64 rowid,
|
||||
const XP_U8* buf, XP_U16 len, const CommsAddrRec* from );
|
||||
bool cb_feedRow( CursesBoardState* cbState, sqlite3_int64 rowid,
|
||||
XP_U16 expectSeed, const XP_U8* buf, XP_U16 len,
|
||||
const CommsAddrRec* from );
|
||||
void cb_feedGame( CursesBoardState* cbState, XP_U32 gameID,
|
||||
const XP_U8* buf, XP_U16 len, const CommsAddrRec* from );
|
||||
void cb_closeAll( CursesBoardState* cbState );
|
||||
|
|
|
@ -1201,9 +1201,7 @@ cursesGotBuf( void* closure, const CommsAddrRec* addr,
|
|||
rowidFromToken( XP_NTOHL( clientToken ), &rowid, &gotSeed );
|
||||
|
||||
/* Figure out if the device is live, or we need to open the game */
|
||||
XP_U16 seed = cb_feedRow( aGlobals->cbState, rowid, buf, len, addr );
|
||||
XP_ASSERT( seed == 0 || gotSeed == seed );
|
||||
XP_USE( seed );
|
||||
cb_feedRow( aGlobals->cbState, rowid, gotSeed, buf, len, addr );
|
||||
|
||||
/* if ( seed == comms_getChannelSeed( cGlobals->game.comms ) ) { */
|
||||
/* gameGotBuf( cGlobals, XP_TRUE, buf, len, addr ); */
|
||||
|
|
Loading…
Add table
Reference in a new issue