diff options
Diffstat (limited to 'src/fs/fs_tree.c')
-rw-r--r-- | src/fs/fs_tree.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/fs/fs_tree.c b/src/fs/fs_tree.c index b38a9c382..211714b86 100644 --- a/src/fs/fs_tree.c +++ b/src/fs/fs_tree.c | |||
@@ -109,6 +109,11 @@ struct GNUNET_FS_TreeEncoder | |||
109 | */ | 109 | */ |
110 | struct ContentHashKey *chk_tree; | 110 | struct ContentHashKey *chk_tree; |
111 | 111 | ||
112 | /** | ||
113 | * Are we currently in 'GNUNET_FS_tree_encoder_next'? | ||
114 | * Flag used to prevent recursion. | ||
115 | */ | ||
116 | int in_next; | ||
112 | }; | 117 | }; |
113 | 118 | ||
114 | 119 | ||
@@ -307,7 +312,8 @@ compute_chk_offset (unsigned int height, | |||
307 | * | 312 | * |
308 | * @param te tree encoder to use | 313 | * @param te tree encoder to use |
309 | */ | 314 | */ |
310 | void GNUNET_FS_tree_encoder_next (struct GNUNET_FS_TreeEncoder * te) | 315 | void |
316 | GNUNET_FS_tree_encoder_next (struct GNUNET_FS_TreeEncoder * te) | ||
311 | { | 317 | { |
312 | struct ContentHashKey *mychk; | 318 | struct ContentHashKey *mychk; |
313 | const void *pt_block; | 319 | const void *pt_block; |
@@ -318,6 +324,8 @@ void GNUNET_FS_tree_encoder_next (struct GNUNET_FS_TreeEncoder * te) | |||
318 | struct GNUNET_CRYPTO_AesInitializationVector iv; | 324 | struct GNUNET_CRYPTO_AesInitializationVector iv; |
319 | unsigned int off; | 325 | unsigned int off; |
320 | 326 | ||
327 | GNUNET_assert (GNUNET_NO == te->in_next); | ||
328 | te->in_next = GNUNET_YES; | ||
321 | if (te->current_depth == te->chk_tree_depth) | 329 | if (te->current_depth == te->chk_tree_depth) |
322 | { | 330 | { |
323 | pt_size = GNUNET_MIN(DBLOCK_SIZE, | 331 | pt_size = GNUNET_MIN(DBLOCK_SIZE, |
@@ -332,6 +340,7 @@ void GNUNET_FS_tree_encoder_next (struct GNUNET_FS_TreeEncoder * te) | |||
332 | GNUNET_SCHEDULER_add_continuation (te->cont, | 340 | GNUNET_SCHEDULER_add_continuation (te->cont, |
333 | te->cls, | 341 | te->cls, |
334 | GNUNET_SCHEDULER_REASON_TIMEOUT); | 342 | GNUNET_SCHEDULER_REASON_TIMEOUT); |
343 | te->in_next = GNUNET_NO; | ||
335 | return; | 344 | return; |
336 | } | 345 | } |
337 | pt_block = iob; | 346 | pt_block = iob; |
@@ -352,6 +361,7 @@ void GNUNET_FS_tree_encoder_next (struct GNUNET_FS_TreeEncoder * te) | |||
352 | GNUNET_SCHEDULER_add_continuation (te->cont, | 361 | GNUNET_SCHEDULER_add_continuation (te->cont, |
353 | te->cls, | 362 | te->cls, |
354 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 363 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
364 | te->in_next = GNUNET_NO; | ||
355 | return; | 365 | return; |
356 | } | 366 | } |
357 | off = compute_chk_offset (te->chk_tree_depth - te->current_depth, | 367 | off = compute_chk_offset (te->chk_tree_depth - te->current_depth, |
@@ -382,6 +392,7 @@ void GNUNET_FS_tree_encoder_next (struct GNUNET_FS_TreeEncoder * te) | |||
382 | te->proc (te->cls, | 392 | te->proc (te->cls, |
383 | &mychk->query, | 393 | &mychk->query, |
384 | te->publish_offset, | 394 | te->publish_offset, |
395 | te->current_depth, | ||
385 | (te->current_depth == te->chk_tree_depth) | 396 | (te->current_depth == te->chk_tree_depth) |
386 | ? GNUNET_BLOCK_TYPE_FS_DBLOCK | 397 | ? GNUNET_BLOCK_TYPE_FS_DBLOCK |
387 | : GNUNET_BLOCK_TYPE_FS_IBLOCK, | 398 | : GNUNET_BLOCK_TYPE_FS_IBLOCK, |
@@ -408,6 +419,7 @@ void GNUNET_FS_tree_encoder_next (struct GNUNET_FS_TreeEncoder * te) | |||
408 | else | 419 | else |
409 | te->current_depth = te->chk_tree_depth; | 420 | te->current_depth = te->chk_tree_depth; |
410 | } | 421 | } |
422 | te->in_next = GNUNET_NO; | ||
411 | } | 423 | } |
412 | 424 | ||
413 | 425 | ||