diff options
Diffstat (limited to 'src/util/mst.c')
-rw-r--r-- | src/util/mst.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/src/util/mst.c b/src/util/mst.c index 0d90c5d10..5e472965f 100644 --- a/src/util/mst.c +++ b/src/util/mst.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2010, 2016 GNUnet e.V. | 3 | Copyright (C) 2010, 2016, 2017 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -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,9 +230,17 @@ 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))) | ||
236 | { | ||
237 | if (GNUNET_SYSERR == cbret) | ||
238 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
239 | "Failure processing message of type %u and size %u\n", | ||
240 | ntohs (hdr->type), | ||
241 | ntohs (hdr->size)); | ||
234 | return GNUNET_SYSERR; | 242 | return GNUNET_SYSERR; |
243 | } | ||
235 | if (mst->off == mst->pos) | 244 | if (mst->off == mst->pos) |
236 | { | 245 | { |
237 | /* reset to beginning of buffer, it's free right now! */ | 246 | /* reset to beginning of buffer, it's free right now! */ |
@@ -271,9 +280,17 @@ do_align: | |||
271 | } | 280 | } |
272 | if (one_shot == GNUNET_YES) | 281 | if (one_shot == GNUNET_YES) |
273 | one_shot = GNUNET_SYSERR; | 282 | one_shot = GNUNET_SYSERR; |
274 | if (GNUNET_SYSERR == mst->cb (mst->cb_cls, | 283 | if (GNUNET_OK != |
275 | hdr)) | 284 | (cbret = mst->cb (mst->cb_cls, |
285 | hdr))) | ||
286 | { | ||
287 | if (GNUNET_SYSERR == cbret) | ||
288 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
289 | "Failure processing message of type %u and size %u\n", | ||
290 | ntohs (hdr->type), | ||
291 | ntohs (hdr->size)); | ||
276 | return GNUNET_SYSERR; | 292 | return GNUNET_SYSERR; |
293 | } | ||
277 | buf += want; | 294 | buf += want; |
278 | size -= want; | 295 | size -= want; |
279 | } | 296 | } |