mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-03 23:04:08 +01:00
remove over-agressive attempt to detect out-of-order messages that was
breaking IR comms.
This commit is contained in:
parent
d03ef80b3e
commit
8667bb77bf
1 changed files with 47 additions and 42 deletions
|
@ -608,9 +608,8 @@ printQueue( CommsCtxt* comms )
|
||||||
i+1, elem->channelNo, elem->msgID );
|
i+1, elem->channelNo, elem->msgID );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
#define printQueue(foo)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* We've received on some channel a message with a certain ID. This means
|
/* We've received on some channel a message with a certain ID. This means
|
||||||
* that all messages sent on that channel with lower IDs have been received
|
* that all messages sent on that channel with lower IDs have been received
|
||||||
* and can be removed from our queue.
|
* and can be removed from our queue.
|
||||||
|
@ -662,11 +661,13 @@ removeFromQueue( CommsCtxt* comms, XP_PlayerAddr channelNo, MsgID msgID )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
XP_STATUSF( "removeFromQueue: queueLen now %d", comms->queueLen );
|
XP_STATUSF( "%s: queueLen now %d", __FUNCTION__, comms->queueLen );
|
||||||
|
|
||||||
XP_ASSERT( comms->queueLen > 0 || comms->msgQueueHead == NULL );
|
XP_ASSERT( comms->queueLen > 0 || comms->msgQueueHead == NULL );
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
printQueue( comms );
|
printQueue( comms );
|
||||||
|
#endif
|
||||||
} /* removeFromQueue */
|
} /* removeFromQueue */
|
||||||
|
|
||||||
static XP_S16
|
static XP_S16
|
||||||
|
@ -856,9 +857,6 @@ comms_checkIncomingStream( CommsCtxt* comms, XWStreamCtxt* stream,
|
||||||
|
|
||||||
channelNo = stream_getU16( stream );
|
channelNo = stream_getU16( stream );
|
||||||
XP_STATUSF( "read channelNo %d", channelNo );
|
XP_STATUSF( "read channelNo %d", channelNo );
|
||||||
if ( channelNo == 0 || channelNo <= comms->nextChannelNo ) {
|
|
||||||
|
|
||||||
validMessage = XP_TRUE;
|
|
||||||
|
|
||||||
msgID = stream_getU32( stream );
|
msgID = stream_getU32( stream );
|
||||||
lastMsgRcd = stream_getU32( stream );
|
lastMsgRcd = stream_getU32( stream );
|
||||||
|
@ -867,6 +865,7 @@ comms_checkIncomingStream( CommsCtxt* comms, XWStreamCtxt* stream,
|
||||||
channelNo );
|
channelNo );
|
||||||
|
|
||||||
removeFromQueue( comms, channelNo, lastMsgRcd );
|
removeFromQueue( comms, channelNo, lastMsgRcd );
|
||||||
|
validMessage = XP_TRUE;
|
||||||
|
|
||||||
/* Problem: need to detect duplicate messages even before
|
/* Problem: need to detect duplicate messages even before
|
||||||
the server's had a chance to assign channels.
|
the server's had a chance to assign channels.
|
||||||
|
@ -883,21 +882,28 @@ comms_checkIncomingStream( CommsCtxt* comms, XWStreamCtxt* stream,
|
||||||
} else {
|
} else {
|
||||||
XP_ASSERT( msgID == 0 );
|
XP_ASSERT( msgID == 0 );
|
||||||
channelNo = ++comms->nextChannelNo;
|
channelNo = ++comms->nextChannelNo;
|
||||||
|
XP_LOGF( "%s: incrementled nextChannelNo to %d",
|
||||||
|
__FUNCTION__, comms->nextChannelNo );
|
||||||
channelWas0 = XP_TRUE;
|
channelWas0 = XP_TRUE;
|
||||||
}
|
}
|
||||||
XP_STATUSF( "assigning channelNo=%d", channelNo );
|
XP_STATUSF( "assigning channelNo=%d", channelNo );
|
||||||
}
|
}
|
||||||
if ( usingRelay || !channelWas0 ) {
|
if ( usingRelay || !channelWas0 ) {
|
||||||
recs = getRecordFor( comms, channelNo );
|
recs = getRecordFor( comms, channelNo );
|
||||||
/* messageID for an incomming message should be one
|
/* messageID for an incoming message should be one
|
||||||
* greater than the id most recently used for that
|
* greater than the id most recently used for that
|
||||||
* channel. */
|
* channel. */
|
||||||
if ( !!recs && (msgID != recs->lastMsgReceived + 1) ) {
|
if ( !!recs ) {
|
||||||
|
if ( msgID != recs->lastMsgReceived + 1 ) {
|
||||||
XP_DEBUGF( "on channel %d, old msgID " XP_LD
|
XP_DEBUGF( "on channel %d, old msgID " XP_LD
|
||||||
" (next should be " XP_LD ")", channelNo,
|
" (next should be " XP_LD ")", channelNo,
|
||||||
msgID, recs->lastMsgReceived+1 );
|
msgID, recs->lastMsgReceived+1 );
|
||||||
validMessage = XP_FALSE;
|
validMessage = XP_FALSE;
|
||||||
}
|
}
|
||||||
|
} else if ( msgID > 1 ) {
|
||||||
|
XP_ASSERT( 0 );
|
||||||
|
validMessage = XP_FALSE;
|
||||||
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if ( !!recs ) {
|
if ( !!recs ) {
|
||||||
XP_ASSERT( lastMsgRcd <= recs->nextMsgID );
|
XP_ASSERT( lastMsgRcd <= recs->nextMsgID );
|
||||||
|
@ -906,7 +912,6 @@ comms_checkIncomingStream( CommsCtxt* comms, XWStreamCtxt* stream,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ( validMessage ) {
|
if ( validMessage ) {
|
||||||
XP_LOGF( "remembering senderID %x for channel %d",
|
XP_LOGF( "remembering senderID %x for channel %d",
|
||||||
|
|
Loading…
Reference in a new issue