diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-10-29 12:32:57 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-10-29 12:32:57 +0100 |
commit | 17f5db6f7c8d60930367738b3d872fbf891486ee (patch) | |
tree | 52e6362a319a417c813876f36733b4bdc567593a /src/util/mst.c | |
parent | d10108c802b56535b03597e9fbb7603b0eeef9c0 (diff) |
allow MST callback to distinguish between disconnect and parse error situations, and only log for the hard errors
Diffstat (limited to 'src/util/mst.c')
-rw-r--r-- | src/util/mst.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/src/util/mst.c b/src/util/mst.c index 4c2a74212c..5e472965f9 100644 --- a/src/util/mst.c +++ b/src/util/mst.c @@ -126,6 +126,7 @@ GNUNET_MST_from_buffer (struct GNUNET_MessageStreamTokenizer *mst, int need_align; unsigned long offset; int ret; + int cbret; GNUNET_assert (mst->off <= mst->pos); GNUNET_assert (mst->pos <= mst->curr_buf); @@ -229,13 +230,15 @@ do_align: if (one_shot == GNUNET_YES) one_shot = GNUNET_SYSERR; mst->off += want; - if (GNUNET_SYSERR == mst->cb (mst->cb_cls, - hdr)) + if (GNUNET_OK != + (cbret = mst->cb (mst->cb_cls, + hdr))) { - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "Failure processing message of type %u and size %u\n", - ntohs (hdr->type), - ntohs (hdr->size)); + if (GNUNET_SYSERR == cbret) + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Failure processing message of type %u and size %u\n", + ntohs (hdr->type), + ntohs (hdr->size)); return GNUNET_SYSERR; } if (mst->off == mst->pos) @@ -277,13 +280,15 @@ do_align: } if (one_shot == GNUNET_YES) one_shot = GNUNET_SYSERR; - if (GNUNET_SYSERR == mst->cb (mst->cb_cls, - hdr)) + if (GNUNET_OK != + (cbret = mst->cb (mst->cb_cls, + hdr))) { - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "Failure processing message of type %u and size %u\n", - ntohs (hdr->type), - ntohs (hdr->size)); + if (GNUNET_SYSERR == cbret) + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Failure processing message of type %u and size %u\n", + ntohs (hdr->type), + ntohs (hdr->size)); return GNUNET_SYSERR; } buf += want; |