From 96ee5bec8c5151bb0991458f481283a69bb25013 Mon Sep 17 00:00:00 2001 From: Eric House Date: Fri, 1 Nov 2019 07:22:56 -0700 Subject: [PATCH] start adding logging specific to comms' windowing (Hi from Santiago) --- xwords4/common/comms.c | 11 ++++++++++- xwords4/linux/Makefile | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/xwords4/common/comms.c b/xwords4/common/comms.c index 181523341..1a39a955e 100644 --- a/xwords4/common/comms.c +++ b/xwords4/common/comms.c @@ -699,6 +699,9 @@ comms_makeFromStream( MPFORMAL XWStreamCtxt* stream, XW_UtilCtxt* util, rec->nextMsgID = stream_getU16( stream ); rec->lastMsgSaved = rec->lastMsgRcd = stream_getU16( stream ); +#ifdef LOG_COMMS_MSGNOS + XP_LOGF( "%s(): read lastMsgRcd of %d for addr %d", __func__, rec->lastMsgRcd, ii ); +#endif if ( version >= STREAM_VERS_BLUETOOTH2 ) { rec->lastMsgAckd = stream_getU16( stream ); } @@ -904,6 +907,9 @@ comms_writeToStream( CommsCtxt* comms, XWStreamCtxt* stream, nAddrRecs = countAddrRecs(comms); stream_putU8( stream, (XP_U8)nAddrRecs ); +#ifdef LOG_COMMS_MSGNOS + int ii = 0; +#endif for ( rec = comms->recs; !!rec; rec = rec->next ) { CommsAddrRec* addr = &rec->addr; @@ -912,6 +918,9 @@ comms_writeToStream( CommsCtxt* comms, XWStreamCtxt* stream, stream_putU16( stream, (XP_U16)rec->nextMsgID ); stream_putU16( stream, (XP_U16)rec->lastMsgRcd ); +#ifdef LOG_COMMS_MSGNOS + XP_LOGF( "%s(): wrote lastMsgRcd of %d for addr %d", __func__, rec->lastMsgRcd, ii++ ); +#endif stream_putU16( stream, (XP_U16)rec->lastMsgAckd ); stream_putU16( stream, rec->channelNo ); if ( addr_hasType( &rec->addr, COMMS_CONN_RELAY ) ) { @@ -2283,7 +2292,7 @@ comms_checkIncomingStream( CommsCtxt* comms, XWStreamCtxt* stream, msgID = stream_getU32( stream ); lastMsgRcd = stream_getU32( stream ); CNO_FMT( cbuf, channelNo ); - XP_LOGF( TAGFMT() "rcd on %s: msgID=%d,lastMsgRcd=%d ", + XP_LOGF( TAGFMT() "rcd on %s: msgID=%d, lastMsgRcd=%d ", TAGPRMS, cbuf, msgID, lastMsgRcd ); payloadSize = stream_getSize( stream ); /* anything left? */ } else { diff --git a/xwords4/linux/Makefile b/xwords4/linux/Makefile index 834b6cdee..6e927ab16 100644 --- a/xwords4/linux/Makefile +++ b/xwords4/linux/Makefile @@ -144,6 +144,8 @@ DEFINES += -DCURSES_CELL_WIDTH=$(CURSES_CELL_WIDTH) endif DEFINES += $(UNICODE) +DEFINES += -DLOG_COMMS_MSGNOS + # Networking-related features. Only set these if STANDALONE is not set ifeq ($(STANDALONE),)