diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-01-29 22:15:22 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-01-29 22:15:22 +0000 |
commit | ef850e1b8b68a9a24155344c6b5c0f41942c8554 (patch) | |
tree | 51b53077c19f41ec31c39c639a0b6011e5f61dc2 /src/fs/fs_dirmetascan.c | |
parent | 7a9cac25484d310cfe9da4a0c6c1887871538366 (diff) | |
download | gnunet-ef850e1b8b68a9a24155344c6b5c0f41942c8554.tar.gz gnunet-ef850e1b8b68a9a24155344c6b5c0f41942c8554.zip |
-fix
Diffstat (limited to 'src/fs/fs_dirmetascan.c')
-rw-r--r-- | src/fs/fs_dirmetascan.c | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/src/fs/fs_dirmetascan.c b/src/fs/fs_dirmetascan.c index 9ee69c860..c4e43eee2 100644 --- a/src/fs/fs_dirmetascan.c +++ b/src/fs/fs_dirmetascan.c | |||
@@ -78,6 +78,11 @@ struct GNUNET_FS_DirScanner | |||
78 | struct GNUNET_FS_ShareTreeItem *pos; | 78 | struct GNUNET_FS_ShareTreeItem *pos; |
79 | 79 | ||
80 | /** | 80 | /** |
81 | * Task scheduled when we are done. | ||
82 | */ | ||
83 | GNUNET_SCHEDULER_TaskIdentifier stop_task; | ||
84 | |||
85 | /** | ||
81 | * Arguments for helper. | 86 | * Arguments for helper. |
82 | */ | 87 | */ |
83 | char *args[4]; | 88 | char *args[4]; |
@@ -101,6 +106,8 @@ GNUNET_FS_directory_scan_abort (struct GNUNET_FS_DirScanner *ds) | |||
101 | /* free resources */ | 106 | /* free resources */ |
102 | if (NULL != ds->toplevel) | 107 | if (NULL != ds->toplevel) |
103 | GNUNET_FS_share_tree_free (ds->toplevel); | 108 | GNUNET_FS_share_tree_free (ds->toplevel); |
109 | if (GNUNET_SCHEDULER_NO_TASK != ds->stop_task) | ||
110 | GNUNET_SCHEDULER_cancel (ds->stop_task); | ||
104 | GNUNET_free_non_null (ds->ex_arg); | 111 | GNUNET_free_non_null (ds->ex_arg); |
105 | GNUNET_free (ds->filename_expanded); | 112 | GNUNET_free (ds->filename_expanded); |
106 | GNUNET_free (ds); | 113 | GNUNET_free (ds); |
@@ -202,6 +209,27 @@ expand_tree (struct GNUNET_FS_ShareTreeItem *parent, | |||
202 | 209 | ||
203 | 210 | ||
204 | /** | 211 | /** |
212 | * Task run last to shut everything down. | ||
213 | * | ||
214 | * @param cls the 'struct GNUNET_FS_DirScanner' | ||
215 | * @param tc unused | ||
216 | */ | ||
217 | static void | ||
218 | finish_scan (void *cls, | ||
219 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
220 | { | ||
221 | struct GNUNET_FS_DirScanner *ds = cls; | ||
222 | |||
223 | ds->stop_task = GNUNET_SCHEDULER_NO_TASK; | ||
224 | GNUNET_HELPER_stop (ds->helper); | ||
225 | ds->helper = NULL; | ||
226 | ds->progress_callback (ds->progress_callback_cls, | ||
227 | NULL, GNUNET_SYSERR, | ||
228 | GNUNET_FS_DIRSCANNER_FINISHED); | ||
229 | } | ||
230 | |||
231 | |||
232 | /** | ||
205 | * Called every time there is data to read from the scanner. | 233 | * Called every time there is data to read from the scanner. |
206 | * Calls the scanner progress handler. | 234 | * Calls the scanner progress handler. |
207 | * | 235 | * |
@@ -354,11 +382,8 @@ process_helper_msgs (void *cls, | |||
354 | GNUNET_break (0); | 382 | GNUNET_break (0); |
355 | break; | 383 | break; |
356 | } | 384 | } |
357 | GNUNET_HELPER_stop (ds->helper); | 385 | ds->stop_task = GNUNET_SCHEDULER_add_now (&finish_scan, |
358 | ds->helper = NULL; | 386 | ds); |
359 | ds->progress_callback (ds->progress_callback_cls, | ||
360 | NULL, GNUNET_SYSERR, | ||
361 | GNUNET_FS_DIRSCANNER_FINISHED); | ||
362 | return; | 387 | return; |
363 | default: | 388 | default: |
364 | GNUNET_break (0); | 389 | GNUNET_break (0); |
@@ -367,7 +392,6 @@ process_helper_msgs (void *cls, | |||
367 | ds->progress_callback (ds->progress_callback_cls, | 392 | ds->progress_callback (ds->progress_callback_cls, |
368 | NULL, GNUNET_SYSERR, | 393 | NULL, GNUNET_SYSERR, |
369 | GNUNET_FS_DIRSCANNER_INTERNAL_ERROR); | 394 | GNUNET_FS_DIRSCANNER_INTERNAL_ERROR); |
370 | |||
371 | } | 395 | } |
372 | 396 | ||
373 | 397 | ||