mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-30 10:26:58 +01:00
Fix crasher: removing ACK'd messages left list in inconsistent state.
Candidate for moving to 4.2 branch if to be used for Palm.
This commit is contained in:
parent
5d243cb4f7
commit
45d41d2872
1 changed files with 9 additions and 6 deletions
|
@ -844,8 +844,9 @@ removeFromQueue( CommsCtxt* comms, XP_PlayerAddr channelNo, MsgID msgID )
|
||||||
__func__, msgID, channelNo, comms->queueLen );
|
__func__, msgID, channelNo, comms->queueLen );
|
||||||
|
|
||||||
if ( (channelNo == 0) || !!getRecordFor(comms, NULL, channelNo) ) {
|
if ( (channelNo == 0) || !!getRecordFor(comms, NULL, channelNo) ) {
|
||||||
MsgQueueElem dummy;
|
|
||||||
MsgQueueElem* keep = &dummy;
|
MsgQueueElem* newHead = NULL;
|
||||||
|
MsgQueueElem* newTail = NULL;
|
||||||
MsgQueueElem* elem;
|
MsgQueueElem* elem;
|
||||||
MsgQueueElem* next;
|
MsgQueueElem* next;
|
||||||
|
|
||||||
|
@ -868,14 +869,16 @@ removeFromQueue( CommsCtxt* comms, XP_PlayerAddr channelNo, MsgID msgID )
|
||||||
if ( !knownGood && (elem->msgID <= msgID) ) {
|
if ( !knownGood && (elem->msgID <= msgID) ) {
|
||||||
freeElem( comms, elem );
|
freeElem( comms, elem );
|
||||||
--comms->queueLen;
|
--comms->queueLen;
|
||||||
|
} else if ( NULL == newHead ) {
|
||||||
|
newHead = newTail = elem;
|
||||||
} else {
|
} else {
|
||||||
keep->next = elem;
|
newTail->next = elem;
|
||||||
keep = elem;
|
newTail = elem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
keep->next = NULL;
|
comms->msgQueueHead = newHead;
|
||||||
comms->msgQueueHead = dummy.next;
|
comms->msgQueueTail = newTail;
|
||||||
}
|
}
|
||||||
|
|
||||||
XP_STATUSF( "%s: queueLen now %d", __func__, comms->queueLen );
|
XP_STATUSF( "%s: queueLen now %d", __func__, comms->queueLen );
|
||||||
|
|
Loading…
Reference in a new issue