aboutsummaryrefslogtreecommitdiff
path: root/src/util/mst.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-10-29 12:32:57 +0100
committerChristian Grothoff <christian@grothoff.org>2017-10-29 12:32:57 +0100
commit17f5db6f7c8d60930367738b3d872fbf891486ee (patch)
tree52e6362a319a417c813876f36733b4bdc567593a /src/util/mst.c
parentd10108c802b56535b03597e9fbb7603b0eeef9c0 (diff)
downloadgnunet-17f5db6f7c8d60930367738b3d872fbf891486ee.tar.gz
gnunet-17f5db6f7c8d60930367738b3d872fbf891486ee.zip
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.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/util/mst.c b/src/util/mst.c
index 4c2a74212..5e472965f 100644
--- a/src/util/mst.c
+++ b/src/util/mst.c
@@ -126,6 +126,7 @@ GNUNET_MST_from_buffer (struct GNUNET_MessageStreamTokenizer *mst,
126 int need_align; 126 int need_align;
127 unsigned long offset; 127 unsigned long offset;
128 int ret; 128 int ret;
129 int cbret;
129 130
130 GNUNET_assert (mst->off <= mst->pos); 131 GNUNET_assert (mst->off <= mst->pos);
131 GNUNET_assert (mst->pos <= mst->curr_buf); 132 GNUNET_assert (mst->pos <= mst->curr_buf);
@@ -229,13 +230,15 @@ do_align:
229 if (one_shot == GNUNET_YES) 230 if (one_shot == GNUNET_YES)
230 one_shot = GNUNET_SYSERR; 231 one_shot = GNUNET_SYSERR;
231 mst->off += want; 232 mst->off += want;
232 if (GNUNET_SYSERR == mst->cb (mst->cb_cls, 233 if (GNUNET_OK !=
233 hdr)) 234 (cbret = mst->cb (mst->cb_cls,
235 hdr)))
234 { 236 {
235 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 237 if (GNUNET_SYSERR == cbret)
236 "Failure processing message of type %u and size %u\n", 238 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
237 ntohs (hdr->type), 239 "Failure processing message of type %u and size %u\n",
238 ntohs (hdr->size)); 240 ntohs (hdr->type),
241 ntohs (hdr->size));
239 return GNUNET_SYSERR; 242 return GNUNET_SYSERR;
240 } 243 }
241 if (mst->off == mst->pos) 244 if (mst->off == mst->pos)
@@ -277,13 +280,15 @@ do_align:
277 } 280 }
278 if (one_shot == GNUNET_YES) 281 if (one_shot == GNUNET_YES)
279 one_shot = GNUNET_SYSERR; 282 one_shot = GNUNET_SYSERR;
280 if (GNUNET_SYSERR == mst->cb (mst->cb_cls, 283 if (GNUNET_OK !=
281 hdr)) 284 (cbret = mst->cb (mst->cb_cls,
285 hdr)))
282 { 286 {
283 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 287 if (GNUNET_SYSERR == cbret)
284 "Failure processing message of type %u and size %u\n", 288 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
285 ntohs (hdr->type), 289 "Failure processing message of type %u and size %u\n",
286 ntohs (hdr->size)); 290 ntohs (hdr->type),
291 ntohs (hdr->size));
287 return GNUNET_SYSERR; 292 return GNUNET_SYSERR;
288 } 293 }
289 buf += want; 294 buf += want;