diff options
Diffstat (limited to 'src/fs/fs_unindex.c')
-rw-r--r-- | src/fs/fs_unindex.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/fs/fs_unindex.c b/src/fs/fs_unindex.c index 5989fd2c0..db0540607 100644 --- a/src/fs/fs_unindex.c +++ b/src/fs/fs_unindex.c | |||
@@ -365,6 +365,7 @@ GNUNET_FS_unindex_process_hash_ (void *cls, | |||
365 | struct GNUNET_FS_UnindexContext *uc = cls; | 365 | struct GNUNET_FS_UnindexContext *uc = cls; |
366 | struct UnindexMessage req; | 366 | struct UnindexMessage req; |
367 | 367 | ||
368 | uc->fhc = NULL; | ||
368 | if (uc->state != UNINDEX_STATE_HASHING) | 369 | if (uc->state != UNINDEX_STATE_HASHING) |
369 | { | 370 | { |
370 | GNUNET_FS_unindex_stop (uc); | 371 | GNUNET_FS_unindex_stop (uc); |
@@ -410,6 +411,11 @@ GNUNET_FS_unindex_signal_suspend_ (void *cls) | |||
410 | struct GNUNET_FS_UnindexContext *uc = cls; | 411 | struct GNUNET_FS_UnindexContext *uc = cls; |
411 | struct GNUNET_FS_ProgressInfo pi; | 412 | struct GNUNET_FS_ProgressInfo pi; |
412 | 413 | ||
414 | if (uc->fhc != NULL) | ||
415 | { | ||
416 | GNUNET_CRYPTO_hash_file_cancel (uc->fhc); | ||
417 | uc->fhc = NULL; | ||
418 | } | ||
413 | GNUNET_FS_end_top (uc->h, uc->top); | 419 | GNUNET_FS_end_top (uc->h, uc->top); |
414 | pi.status = GNUNET_FS_STATUS_UNINDEX_SUSPEND; | 420 | pi.status = GNUNET_FS_STATUS_UNINDEX_SUSPEND; |
415 | GNUNET_FS_unindex_make_status_ (&pi, uc, | 421 | GNUNET_FS_unindex_make_status_ (&pi, uc, |
@@ -454,13 +460,12 @@ GNUNET_FS_unindex_start (struct GNUNET_FS_Handle *h, | |||
454 | pi.status = GNUNET_FS_STATUS_UNINDEX_START; | 460 | pi.status = GNUNET_FS_STATUS_UNINDEX_START; |
455 | pi.value.unindex.eta = GNUNET_TIME_UNIT_FOREVER_REL; | 461 | pi.value.unindex.eta = GNUNET_TIME_UNIT_FOREVER_REL; |
456 | GNUNET_FS_unindex_make_status_ (&pi, ret, 0); | 462 | GNUNET_FS_unindex_make_status_ (&pi, ret, 0); |
457 | /* FIXME: must be able to abort hashing here! */ | 463 | ret->fhc = GNUNET_CRYPTO_hash_file (h->sched, |
458 | GNUNET_CRYPTO_hash_file (h->sched, | 464 | GNUNET_SCHEDULER_PRIORITY_IDLE, |
459 | GNUNET_SCHEDULER_PRIORITY_IDLE, | 465 | filename, |
460 | filename, | 466 | HASHING_BLOCKSIZE, |
461 | HASHING_BLOCKSIZE, | 467 | &GNUNET_FS_unindex_process_hash_, |
462 | &GNUNET_FS_unindex_process_hash_, | 468 | ret); |
463 | ret); | ||
464 | ret->top = GNUNET_FS_make_top (h, | 469 | ret->top = GNUNET_FS_make_top (h, |
465 | &GNUNET_FS_unindex_signal_suspend_, | 470 | &GNUNET_FS_unindex_signal_suspend_, |
466 | ret); | 471 | ret); |
@@ -478,7 +483,11 @@ GNUNET_FS_unindex_stop (struct GNUNET_FS_UnindexContext *uc) | |||
478 | { | 483 | { |
479 | struct GNUNET_FS_ProgressInfo pi; | 484 | struct GNUNET_FS_ProgressInfo pi; |
480 | 485 | ||
481 | /* FIXME: stop hashing (if still ongoing) */ | 486 | if (uc->fhc != NULL) |
487 | { | ||
488 | GNUNET_CRYPTO_hash_file_cancel (uc->fhc); | ||
489 | uc->fhc = NULL; | ||
490 | } | ||
482 | /* FIXME: disconnect uc->client (if still connected) */ | 491 | /* FIXME: disconnect uc->client (if still connected) */ |
483 | /* FIXME: disconnect from datastore (if still connected) */ | 492 | /* FIXME: disconnect from datastore (if still connected) */ |
484 | /* FIXME: other termination operations? */ | 493 | /* FIXME: other termination operations? */ |