From b35022d6d82b62605ebbcb7db565371af720552f Mon Sep 17 00:00:00 2001 From: t3sserakt Date: Mon, 25 Apr 2022 17:38:31 +0200 Subject: - added debug information --- src/util/client.c | 10 ++++++---- src/util/mst.c | 19 +++++++++++++------ 2 files changed, 19 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/util/client.c b/src/util/client.c index 4e5eca32a..9950c9e2f 100644 --- a/src/util/client.c +++ b/src/util/client.c @@ -261,12 +261,13 @@ transmit_ready (void *cls) len = ntohs (cstate->msg->size); GNUNET_assert (cstate->msg_off < len); LOG (GNUNET_ERROR_TYPE_DEBUG, - "message of type %u trying to send with socket %p (MQ: %p\n", + "message of type %u and size %u trying to send with socket %p (MQ: %p\n", ntohs (cstate->msg->type), + ntohs (cstate->msg->size), cstate->sock, cstate->mq); -RETRY: + RETRY: ret = GNUNET_NETWORK_socket_send (cstate->sock, &pos[cstate->msg_off], len - cstate->msg_off); @@ -311,8 +312,9 @@ RETRY: return; } LOG (GNUNET_ERROR_TYPE_DEBUG, - "sending message of type %u successful\n", - ntohs (cstate->msg->type)); + "sending message of type %u and size %u successful\n", + ntohs (cstate->msg->type), + ntohs (cstate->msg->size)); cstate->msg = NULL; GNUNET_MQ_impl_send_continue (cstate->mq); } diff --git a/src/util/mst.c b/src/util/mst.c index 13835ffd0..2236f2883 100644 --- a/src/util/mst.c +++ b/src/util/mst.c @@ -129,14 +129,16 @@ GNUNET_MST_from_buffer (struct GNUNET_MessageStreamTokenizer *mst, GNUNET_assert (mst->off <= mst->pos); GNUNET_assert (mst->pos <= mst->curr_buf); LOG (GNUNET_ERROR_TYPE_DEBUG, - "MST receives %u bytes with %u bytes already in private buffer\n", + "MST receives %u bytes with %u (%u/%u) bytes already in private buffer\n", (unsigned int) size, - (unsigned int) (mst->pos - mst->off)); + (unsigned int) (mst->pos - mst->off), + (unsigned int) mst->pos, + (unsigned int) mst->off); ret = GNUNET_OK; ibuf = (char *) mst->hdr; while (mst->pos > 0) { -do_align: + do_align: GNUNET_assert (mst->pos >= mst->off); if ((mst->curr_buf - mst->off < sizeof(struct GNUNET_MessageHeader)) || (0 != (mst->off % ALIGN_FACTOR))) @@ -172,6 +174,9 @@ do_align: } hdr = (const struct GNUNET_MessageHeader *) &ibuf[mst->off]; want = ntohs (hdr->size); + LOG (GNUNET_ERROR_TYPE_DEBUG, + "We want to read message of size %u\n", + want); if (want < sizeof(struct GNUNET_MessageHeader)) { GNUNET_break_op (0); @@ -299,7 +304,7 @@ do_align: goto do_align; } } -copy: + copy: if ((size > 0) && (! purge)) { if (size + mst->pos > mst->curr_buf) @@ -321,8 +326,10 @@ copy: mst->pos = 0; } LOG (GNUNET_ERROR_TYPE_DEBUG, - "Server-mst leaves %u bytes in private buffer\n", - (unsigned int) (mst->pos - mst->off)); + "Server-mst leaves %u (%u/%u) bytes in private buffer\n", + (unsigned int) (mst->pos - mst->off), + (unsigned int) mst->pos, + (unsigned int) mst->off); return ret; } -- cgit v1.2.3