From 652b7e703acb4cc685a2958e20ee97ca3ef5d02f Mon Sep 17 00:00:00 2001 From: Andy2 Date: Tue, 18 Oct 2011 21:27:28 -0700 Subject: [PATCH] Remove difference between debug- and non-debug stream format. --- xwords4/common/comms.c | 48 ------------------------------------------ 1 file changed, 48 deletions(-) diff --git a/xwords4/common/comms.c b/xwords4/common/comms.c index bb1ed906e..a5ffbcc9a 100644 --- a/xwords4/common/comms.c +++ b/xwords4/common/comms.c @@ -61,10 +61,6 @@ typedef struct MsgQueueElem { typedef struct AddressRecord { struct AddressRecord* next; CommsAddrRec addr; -#ifdef DEBUG - XP_U16 lastACK; - XP_U16 nUniqueBytes; -#endif MsgID nextMsgID; /* on a per-channel basis */ MsgID lastMsgRcd; /* on a per-channel basis */ /* only used if COMMS_HEARTBEAT set except for serialization (to_stream) */ @@ -135,9 +131,6 @@ struct CommsCtxt { } r; XP_Bool isServer; -#ifdef DEBUG - XP_U16 nUniqueBytes; -#endif MPSLOT }; @@ -554,9 +547,6 @@ comms_makeFromStream( MPFORMAL XWStreamCtxt* stream, XW_UtilCtxt* util, sizeof(comms->r.connName) ); } -#ifdef DEBUG - comms->nUniqueBytes = stream_getU16( stream ); -#endif comms->queueLen = stream_getU8( stream ); nAddrRecs = stream_getU8( stream ); @@ -574,11 +564,6 @@ comms_makeFromStream( MPFORMAL XWStreamCtxt* stream, XW_UtilCtxt* util, rec->r.hostID = stream_getU8( stream ); } -#ifdef DEBUG - rec->lastACK = stream_getU16( stream ); - rec->nUniqueBytes = stream_getU16( stream ); -#endif - *prevsAddrNext = rec; prevsAddrNext = &rec->next; } @@ -730,10 +715,6 @@ comms_writeToStream( const CommsCtxt* comms, XWStreamCtxt* stream ) stringToStream( stream, comms->r.connName ); } -#ifdef DEBUG - stream_putU16( stream, comms->nUniqueBytes ); -#endif - XP_ASSERT( comms->queueLen <= 255 ); stream_putU8( stream, (XP_U8)comms->queueLen ); @@ -751,10 +732,6 @@ comms_writeToStream( const CommsCtxt* comms, XWStreamCtxt* stream ) if ( rec->addr.conType == COMMS_CONN_RELAY ) { stream_putU8( stream, rec->r.hostID ); /* unneeded unless RELAY */ } -#ifdef DEBUG - stream_putU16( stream, rec->lastACK ); - stream_putU16( stream, rec->nUniqueBytes ); -#endif } for ( msg = comms->msgQueueHead; !!msg; msg = msg->next ) { @@ -883,14 +860,6 @@ makeElemWithID( CommsCtxt* comms, MsgID msgID, AddressRecord* rec, MsgQueueElem* newMsgElem; XWStreamCtxt* msgStream; -#ifdef DEBUG - if ( !!rec ) { - rec->nUniqueBytes += streamSize; - } else { - comms->nUniqueBytes += streamSize; - } -#endif - newMsgElem = (MsgQueueElem*)XP_MALLOC( comms->mpool, sizeof( *newMsgElem ) ); newMsgElem->channelNo = channelNo; @@ -1614,9 +1583,6 @@ validateChannelMessage( CommsCtxt* comms, const CommsAddrRec* addr, removeFromQueue( comms, channelNo, lastMsgRcd ); if ( msgID == rec->lastMsgRcd + 1 ) { updateChannelAddress( rec, addr ); -#ifdef DEBUG - rec->lastACK = (XP_U16)lastMsgRcd; -#endif } else { XP_LOGF( "%s: expected %ld, got %ld", __func__, rec->lastMsgRcd + 1, msgID ); @@ -1890,11 +1856,6 @@ comms_getStats( CommsCtxt* comms, XWStreamCtxt* stream ) stream_catString( stream, buf ); } - XP_SNPRINTF( (XP_UCHAR*)buf, sizeof(buf), - (XP_UCHAR*)"channel-less bytes sent: %d\n", - comms->nUniqueBytes ); - stream_catString( stream, buf ); - now = util_getCurSeconds( comms->util ); for ( rec = comms->recs; !!rec; rec = rec->next ) { XP_SNPRINTF( (XP_UCHAR*)buf, sizeof(buf), @@ -1907,19 +1868,10 @@ comms_getStats( CommsCtxt* comms, XWStreamCtxt* stream ) rec->nextMsgID ); stream_catString( stream, buf ); - XP_SNPRINTF( (XP_UCHAR*)buf, sizeof(buf), - (XP_UCHAR*)"Unique bytes sent: %d\n", - rec->nUniqueBytes ); - stream_catString( stream, buf ); - XP_SNPRINTF( (XP_UCHAR*)buf, sizeof(buf), (XP_UCHAR*)"Last message received: %ld\n", rec->lastMsgRcd ); stream_catString( stream, buf ); - XP_SNPRINTF( (XP_UCHAR*)buf, sizeof(buf), - (XP_UCHAR*)"Last message acknowledged: %d\n", - rec->lastACK ); - stream_catString( stream, buf ); } } /* comms_getStats */ #endif