diff options
author | Christian Grothoff <grothoff@gnunet.org> | 2021-11-21 12:47:16 +0100 |
---|---|---|
committer | Christian Grothoff <grothoff@gnunet.org> | 2021-11-21 12:47:33 +0100 |
commit | 5159badd0e999fbcd610e3db22b5415571d9fa54 (patch) | |
tree | b2c139ab011fdec76a34f908117b7deae496deae /src/util/secmod_common.c | |
parent | 56318f53e201f0f91e6cd50d485f6ff44b8cf9d0 (diff) | |
download | exchange-5159badd0e999fbcd610e3db22b5415571d9fa54.tar.xz |
another fix related to #7099
Diffstat (limited to 'src/util/secmod_common.c')
-rw-r--r-- | src/util/secmod_common.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/util/secmod_common.c b/src/util/secmod_common.c index 830fbf32a..ee390640d 100644 --- a/src/util/secmod_common.c +++ b/src/util/secmod_common.c @@ -229,18 +229,19 @@ TES_read_work (void *cls, { struct TES_Client *client = cls; char *buf = client->iobuf; - ssize_t buf_size; size_t off = 0; uint16_t msize; const struct GNUNET_MessageHeader *hdr; do { - buf_size = recv (client->csock, - &buf[off], - sizeof (client->iobuf) - off, - 0); - if (-1 == buf_size) + ssize_t recv_size; + + recv_size = recv (client->csock, + &buf[off], + sizeof (client->iobuf) - off, + 0); + if (-1 == recv_size) { if ( (0 == off) && (EAGAIN == errno) ) @@ -257,17 +258,23 @@ TES_read_work (void *cls, "recv"); return GNUNET_SYSERR; } - if (0 == buf_size) + if (0 == recv_size) { /* regular disconnect? */ GNUNET_break_op (0 == off); return GNUNET_SYSERR; } - off += buf_size; + off += recv_size; if (off < sizeof (struct GNUNET_MessageHeader)) continue; hdr = (const struct GNUNET_MessageHeader *) buf; msize = ntohs (hdr->size); +#if 0 + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Received message of type %u with %u bytes\n", + (unsigned int) ntohs (hdr->type), + (unsigned int) msize); +#endif if (msize < sizeof (struct GNUNET_MessageHeader)) { GNUNET_break_op (0); |