add a bit more logging to comms

This commit is contained in:
Eric House 2012-11-13 06:14:36 -08:00
parent 76c938cc67
commit 43b1e219f3
2 changed files with 22 additions and 8 deletions

View file

@ -785,9 +785,11 @@ comms_saveSucceeded( CommsCtxt* comms, XP_U16 saveToken )
XP_LOGF( "%s(saveToken=%d)", __func__, saveToken ); XP_LOGF( "%s(saveToken=%d)", __func__, saveToken );
XP_ASSERT( !!comms ); XP_ASSERT( !!comms );
if ( saveToken == comms->lastSaveToken ) { if ( saveToken == comms->lastSaveToken ) {
XP_LOGF( "%s: lastSave matches", __func__ );
AddressRecord* rec; AddressRecord* rec;
for ( rec = comms->recs; !!rec; rec = rec->next ) { for ( rec = comms->recs; !!rec; rec = rec->next ) {
XP_LOGF( "%s: lastSave matches; updating lastMsgSaved %ld to "
"lastMsgRcd %ld", __func__, rec->lastMsgSaved,
rec->lastMsgRcd );
rec->lastMsgSaved = rec->lastMsgRcd; rec->lastMsgSaved = rec->lastMsgRcd;
} }
#ifdef XWFEATURE_COMMSACK #ifdef XWFEATURE_COMMSACK
@ -1037,9 +1039,10 @@ addToQueue( CommsCtxt* comms, MsgQueueElem* newMsgElem )
XP_ASSERT( comms->queueLen > 0 ); XP_ASSERT( comms->queueLen > 0 );
} }
++comms->queueLen; ++comms->queueLen;
XP_LOGF( "%s: queueLen now %d after channelNo: %d; msgID: " XP_LD, XP_LOGF( "%s: queueLen now %d after channelNo: %d; msgID: " XP_LD
__func__, comms->queueLen, "; len: %d", __func__, comms->queueLen,
newMsgElem->channelNo & CHANNEL_MASK, newMsgElem->msgID ); newMsgElem->channelNo & CHANNEL_MASK, newMsgElem->msgID,
newMsgElem->len );
} /* addToQueue */ } /* addToQueue */
#ifdef DEBUG #ifdef DEBUG
@ -1244,14 +1247,25 @@ comms_resendAll( CommsCtxt* comms )
void void
comms_ackAny( CommsCtxt* comms ) comms_ackAny( CommsCtxt* comms )
{ {
#ifdef DEBUG
XP_Bool noneSent = XP_TRUE;
#endif
AddressRecord* rec; AddressRecord* rec;
for ( rec = comms->recs; !!rec; rec = rec->next ) { for ( rec = comms->recs; !!rec; rec = rec->next ) {
if ( rec->lastMsgAckd < rec->lastMsgRcd ) { if ( rec->lastMsgAckd < rec->lastMsgRcd ) {
XP_LOGF( "%s: %ld < %ld: rec needs ack", __func__, #ifdef DEBUG
rec->lastMsgAckd, rec->lastMsgRcd ); noneSent = XP_FALSE;
#endif
XP_LOGF( "%s: channel %x; %ld < %ld: rec needs ack", __func__,
rec->channelNo, rec->lastMsgAckd, rec->lastMsgRcd );
sendEmptyMsg( comms, rec ); sendEmptyMsg( comms, rec );
} }
} }
#ifdef DEBUG
if ( noneSent ) {
XP_LOGF( "%s: nothing to send", __func__ );
}
#endif
} }
#endif #endif
@ -1845,7 +1859,7 @@ sendEmptyMsg( CommsCtxt* comms, AddressRecord* rec )
0 /*rec? rec->lastMsgRcd : 0*/, 0 /*rec? rec->lastMsgRcd : 0*/,
rec, rec,
rec? rec->channelNo : 0, NULL ); rec? rec->channelNo : 0, NULL );
sendMsg( comms, elem ); (void)sendMsg( comms, elem );
freeElem( comms, elem ); freeElem( comms, elem );
} /* sendEmptyMsg */ } /* sendEmptyMsg */
#endif #endif

View file

@ -147,7 +147,7 @@ stack_getHash( const StackCtxt* stack )
stream_copyBits( stack->data, 0, stack->top, buf, &len ); stream_copyBits( stack->data, 0, stack->top, buf, &len );
// LOG_HEX( buf, len, __func__ ); // LOG_HEX( buf, len, __func__ );
hash = finishHash( augmentHash( 0L, buf, len ) ); hash = finishHash( augmentHash( 0L, buf, len ) );
LOG_RETURNF( "%.8X", (unsigned int)hash ); // LOG_RETURNF( "%.8X", (unsigned int)hash );
return hash; return hash;
} /* stack_getHash */ } /* stack_getHash */
#endif #endif