mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-29 10:26:36 +01:00
print checksums of sent and received messages
This commit is contained in:
parent
195f873ab0
commit
c77021231c
1 changed files with 19 additions and 0 deletions
|
@ -1204,6 +1204,11 @@ sendMsg( CommsCtxt* comms, MsgQueueElem* elem )
|
||||||
|
|
||||||
channelNo = elem->channelNo;
|
channelNo = elem->channelNo;
|
||||||
|
|
||||||
|
#ifdef COMMS_CHECKSUM
|
||||||
|
XP_LOGF( "%s: sending message of len %d with sum %s", __func__, elem->len,
|
||||||
|
elem->checksum );
|
||||||
|
#endif
|
||||||
|
|
||||||
if ( 0 ) {
|
if ( 0 ) {
|
||||||
#ifdef XWFEATURE_RELAY
|
#ifdef XWFEATURE_RELAY
|
||||||
} else if ( conType == COMMS_CONN_RELAY ) {
|
} else if ( conType == COMMS_CONN_RELAY ) {
|
||||||
|
@ -1809,6 +1814,9 @@ comms_checkIncomingStream( CommsCtxt* comms, XWStreamCtxt* stream,
|
||||||
XP_Bool usingRelay = XP_FALSE;
|
XP_Bool usingRelay = XP_FALSE;
|
||||||
|
|
||||||
XP_ASSERT( retAddr == NULL || comms->addr.conType == retAddr->conType );
|
XP_ASSERT( retAddr == NULL || comms->addr.conType == retAddr->conType );
|
||||||
|
#ifdef COMMS_CHECKSUM
|
||||||
|
XP_U16 initialLen = stream_getSize( stream );
|
||||||
|
#endif
|
||||||
|
|
||||||
if ( !preProcess( comms, stream, &usingRelay, &senderID ) ) {
|
if ( !preProcess( comms, stream, &usingRelay, &senderID ) ) {
|
||||||
XP_U32 connID;
|
XP_U32 connID;
|
||||||
|
@ -1816,6 +1824,17 @@ comms_checkIncomingStream( CommsCtxt* comms, XWStreamCtxt* stream,
|
||||||
MsgID msgID;
|
MsgID msgID;
|
||||||
MsgID lastMsgRcd;
|
MsgID lastMsgRcd;
|
||||||
|
|
||||||
|
#ifdef COMMS_CHECKSUM
|
||||||
|
{
|
||||||
|
XP_U16 len = stream_getSize( stream );
|
||||||
|
// stream_getPtr pts at base, but sum excludes relay header
|
||||||
|
const XP_U8* ptr = initialLen - len + stream_getPtr( stream );
|
||||||
|
gchar* sum = g_compute_checksum_for_data( G_CHECKSUM_MD5, ptr, len );
|
||||||
|
XP_LOGF( "%s: got message of len %d with sum %s", __func__, len, sum );
|
||||||
|
g_free( sum );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* reject too-small message */
|
/* reject too-small message */
|
||||||
if ( stream_getSize( stream ) >=
|
if ( stream_getSize( stream ) >=
|
||||||
(sizeof(connID) + sizeof(channelNo)
|
(sizeof(connID) + sizeof(channelNo)
|
||||||
|
|
Loading…
Reference in a new issue