diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-02-18 19:03:26 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-02-18 19:03:26 +0000 |
commit | c456c5bb7f9b95d1800ad6e2892a77f40a08493e (patch) | |
tree | 8b04e75f8a65225848816d8e588b28413ff9d758 /src/fs/gnunet-fs.c | |
parent | 6d0a62078edfa5c0001acb93d517c674c5124f4e (diff) | |
download | gnunet-c456c5bb7f9b95d1800ad6e2892a77f40a08493e.tar.gz gnunet-c456c5bb7f9b95d1800ad6e2892a77f40a08493e.zip |
make all (?) asynchronously operating FS operations actually cancel-able
Diffstat (limited to 'src/fs/gnunet-fs.c')
-rw-r--r-- | src/fs/gnunet-fs.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/fs/gnunet-fs.c b/src/fs/gnunet-fs.c index 8cf08ec28..0b2892371 100644 --- a/src/fs/gnunet-fs.c +++ b/src/fs/gnunet-fs.c | |||
@@ -47,20 +47,6 @@ static int verbose; | |||
47 | 47 | ||
48 | 48 | ||
49 | /** | 49 | /** |
50 | * Shutdown this process. | ||
51 | * | ||
52 | * @param cls unused | ||
53 | * @param tc unused | ||
54 | */ | ||
55 | static void | ||
56 | do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
57 | { | ||
58 | GNUNET_FS_stop (fs); | ||
59 | fs = NULL; | ||
60 | } | ||
61 | |||
62 | |||
63 | /** | ||
64 | * Print indexed filenames to stdout. | 50 | * Print indexed filenames to stdout. |
65 | * | 51 | * |
66 | * @param cls closure | 52 | * @param cls closure |
@@ -71,6 +57,12 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
71 | static int | 57 | static int |
72 | print_indexed (void *cls, const char *filename, const GNUNET_HashCode * file_id) | 58 | print_indexed (void *cls, const char *filename, const GNUNET_HashCode * file_id) |
73 | { | 59 | { |
60 | if (NULL == filename) | ||
61 | { | ||
62 | GNUNET_FS_stop (fs); | ||
63 | fs = NULL; | ||
64 | return GNUNET_OK; | ||
65 | } | ||
74 | if (verbose) | 66 | if (verbose) |
75 | FPRINTF (stdout, "%s: %s\n", GNUNET_h2s (file_id), filename); | 67 | FPRINTF (stdout, "%s: %s\n", GNUNET_h2s (file_id), filename); |
76 | else | 68 | else |
@@ -100,7 +92,13 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
100 | ret = 1; | 92 | ret = 1; |
101 | return; | 93 | return; |
102 | } | 94 | } |
103 | GNUNET_FS_get_indexed_files (fs, &print_indexed, NULL, &do_shutdown, NULL); | 95 | if (NULL == GNUNET_FS_get_indexed_files (fs, &print_indexed, NULL)) |
96 | { | ||
97 | ret = 2; | ||
98 | GNUNET_FS_stop (fs); | ||
99 | fs = NULL; | ||
100 | return; | ||
101 | } | ||
104 | } | 102 | } |
105 | } | 103 | } |
106 | 104 | ||