diff options
Diffstat (limited to 'src/util/mst.c')
-rw-r--r-- | src/util/mst.c | 19 |
1 files changed, 13 insertions, 6 deletions
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, | |||
129 | GNUNET_assert (mst->off <= mst->pos); | 129 | GNUNET_assert (mst->off <= mst->pos); |
130 | GNUNET_assert (mst->pos <= mst->curr_buf); | 130 | GNUNET_assert (mst->pos <= mst->curr_buf); |
131 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 131 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
132 | "MST receives %u bytes with %u bytes already in private buffer\n", | 132 | "MST receives %u bytes with %u (%u/%u) bytes already in private buffer\n", |
133 | (unsigned int) size, | 133 | (unsigned int) size, |
134 | (unsigned int) (mst->pos - mst->off)); | 134 | (unsigned int) (mst->pos - mst->off), |
135 | (unsigned int) mst->pos, | ||
136 | (unsigned int) mst->off); | ||
135 | ret = GNUNET_OK; | 137 | ret = GNUNET_OK; |
136 | ibuf = (char *) mst->hdr; | 138 | ibuf = (char *) mst->hdr; |
137 | while (mst->pos > 0) | 139 | while (mst->pos > 0) |
138 | { | 140 | { |
139 | do_align: | 141 | do_align: |
140 | GNUNET_assert (mst->pos >= mst->off); | 142 | GNUNET_assert (mst->pos >= mst->off); |
141 | if ((mst->curr_buf - mst->off < sizeof(struct GNUNET_MessageHeader)) || | 143 | if ((mst->curr_buf - mst->off < sizeof(struct GNUNET_MessageHeader)) || |
142 | (0 != (mst->off % ALIGN_FACTOR))) | 144 | (0 != (mst->off % ALIGN_FACTOR))) |
@@ -172,6 +174,9 @@ do_align: | |||
172 | } | 174 | } |
173 | hdr = (const struct GNUNET_MessageHeader *) &ibuf[mst->off]; | 175 | hdr = (const struct GNUNET_MessageHeader *) &ibuf[mst->off]; |
174 | want = ntohs (hdr->size); | 176 | want = ntohs (hdr->size); |
177 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
178 | "We want to read message of size %u\n", | ||
179 | want); | ||
175 | if (want < sizeof(struct GNUNET_MessageHeader)) | 180 | if (want < sizeof(struct GNUNET_MessageHeader)) |
176 | { | 181 | { |
177 | GNUNET_break_op (0); | 182 | GNUNET_break_op (0); |
@@ -299,7 +304,7 @@ do_align: | |||
299 | goto do_align; | 304 | goto do_align; |
300 | } | 305 | } |
301 | } | 306 | } |
302 | copy: | 307 | copy: |
303 | if ((size > 0) && (! purge)) | 308 | if ((size > 0) && (! purge)) |
304 | { | 309 | { |
305 | if (size + mst->pos > mst->curr_buf) | 310 | if (size + mst->pos > mst->curr_buf) |
@@ -321,8 +326,10 @@ copy: | |||
321 | mst->pos = 0; | 326 | mst->pos = 0; |
322 | } | 327 | } |
323 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 328 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
324 | "Server-mst leaves %u bytes in private buffer\n", | 329 | "Server-mst leaves %u (%u/%u) bytes in private buffer\n", |
325 | (unsigned int) (mst->pos - mst->off)); | 330 | (unsigned int) (mst->pos - mst->off), |
331 | (unsigned int) mst->pos, | ||
332 | (unsigned int) mst->off); | ||
326 | return ret; | 333 | return ret; |
327 | } | 334 | } |
328 | 335 | ||