diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-08-03 09:35:48 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-08-03 09:35:48 +0000 |
commit | d3e7a5e40dd2d5409009a30e1e41148c4d852673 (patch) | |
tree | 21ff19580a99137e9b8aec4393feb67f0f1c7b5a /src/fs/test_fs_search_with_and.c | |
parent | ec69ceabc67a72373a2579d871c5fe85676a73bd (diff) | |
download | gnunet-d3e7a5e40dd2d5409009a30e1e41148c4d852673.tar.gz gnunet-d3e7a5e40dd2d5409009a30e1e41148c4d852673.zip |
-use simpler, modern scheduler API
Diffstat (limited to 'src/fs/test_fs_search_with_and.c')
-rw-r--r-- | src/fs/test_fs_search_with_and.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/fs/test_fs_search_with_and.c b/src/fs/test_fs_search_with_and.c index 55498ddca..7798f88c0 100644 --- a/src/fs/test_fs_search_with_and.c +++ b/src/fs/test_fs_search_with_and.c | |||
@@ -138,7 +138,7 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event) | |||
138 | char *emsg = NULL; | 138 | char *emsg = NULL; |
139 | kuri = GNUNET_FS_uri_ksk_create ("+down_foo +down_bar", &emsg); | 139 | kuri = GNUNET_FS_uri_ksk_create ("+down_foo +down_bar", &emsg); |
140 | GNUNET_assert (kuri != NULL); | 140 | GNUNET_assert (kuri != NULL); |
141 | 141 | ||
142 | start = GNUNET_TIME_absolute_get (); | 142 | start = GNUNET_TIME_absolute_get (); |
143 | search = | 143 | search = |
144 | GNUNET_FS_search_start (fs, kuri, 1, GNUNET_FS_SEARCH_OPTION_NONE, | 144 | GNUNET_FS_search_start (fs, kuri, 1, GNUNET_FS_SEARCH_OPTION_NONE, |
@@ -150,21 +150,18 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event) | |||
150 | case GNUNET_FS_STATUS_SEARCH_RESULT: | 150 | case GNUNET_FS_STATUS_SEARCH_RESULT: |
151 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 151 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
152 | "Search complete.\n"); | 152 | "Search complete.\n"); |
153 | GNUNET_SCHEDULER_add_continuation (&abort_search_task, NULL, | 153 | GNUNET_SCHEDULER_add_now (&abort_search_task, NULL); |
154 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | ||
155 | break; | 154 | break; |
156 | case GNUNET_FS_STATUS_PUBLISH_ERROR: | 155 | case GNUNET_FS_STATUS_PUBLISH_ERROR: |
157 | FPRINTF (stderr, "Error publishing file: %s\n", | 156 | FPRINTF (stderr, "Error publishing file: %s\n", |
158 | event->value.publish.specifics.error.message); | 157 | event->value.publish.specifics.error.message); |
159 | GNUNET_break (0); | 158 | GNUNET_break (0); |
160 | GNUNET_SCHEDULER_add_continuation (&abort_publish_task, NULL, | 159 | GNUNET_SCHEDULER_add_now (&abort_publish_task, NULL); |
161 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | ||
162 | break; | 160 | break; |
163 | case GNUNET_FS_STATUS_SEARCH_ERROR: | 161 | case GNUNET_FS_STATUS_SEARCH_ERROR: |
164 | FPRINTF (stderr, "Error searching file: %s\n", | 162 | FPRINTF (stderr, "Error searching file: %s\n", |
165 | event->value.search.specifics.error.message); | 163 | event->value.search.specifics.error.message); |
166 | GNUNET_SCHEDULER_add_continuation (&abort_search_task, NULL, | 164 | GNUNET_SCHEDULER_add_now (&abort_search_task, NULL); |
167 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | ||
168 | break; | 165 | break; |
169 | case GNUNET_FS_STATUS_PUBLISH_START: | 166 | case GNUNET_FS_STATUS_PUBLISH_START: |
170 | GNUNET_assert (0 == strcmp ("publish-context", event->value.publish.cctx)); | 167 | GNUNET_assert (0 == strcmp ("publish-context", event->value.publish.cctx)); |
@@ -189,8 +186,7 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event) | |||
189 | break; | 186 | break; |
190 | case GNUNET_FS_STATUS_SEARCH_STOPPED: | 187 | case GNUNET_FS_STATUS_SEARCH_STOPPED: |
191 | GNUNET_assert (search == event->value.search.sc); | 188 | GNUNET_assert (search == event->value.search.sc); |
192 | GNUNET_SCHEDULER_add_continuation (&abort_publish_task, NULL, | 189 | GNUNET_SCHEDULER_add_now (&abort_publish_task, NULL); |
193 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | ||
194 | break; | 190 | break; |
195 | default: | 191 | default: |
196 | FPRINTF (stderr, "Unexpected event: %d\n", event->status); | 192 | FPRINTF (stderr, "Unexpected event: %d\n", event->status); |
@@ -220,7 +216,7 @@ run (void *cls, | |||
220 | fs = GNUNET_FS_start (cfg, "test-fs-search", &progress_cb, NULL, | 216 | fs = GNUNET_FS_start (cfg, "test-fs-search", &progress_cb, NULL, |
221 | GNUNET_FS_FLAGS_NONE, GNUNET_FS_OPTIONS_END); | 217 | GNUNET_FS_FLAGS_NONE, GNUNET_FS_OPTIONS_END); |
222 | GNUNET_assert (NULL != fs); | 218 | GNUNET_assert (NULL != fs); |
223 | 219 | ||
224 | processed_files = 0; | 220 | processed_files = 0; |
225 | for(j = 0; j < NUM_FILES; j++){ | 221 | for(j = 0; j < NUM_FILES; j++){ |
226 | buf = GNUNET_malloc (FILESIZE); | 222 | buf = GNUNET_malloc (FILESIZE); |
@@ -244,8 +240,8 @@ run (void *cls, | |||
244 | GNUNET_FS_PUBLISH_OPTION_NONE); | 240 | GNUNET_FS_PUBLISH_OPTION_NONE); |
245 | GNUNET_assert (publish != NULL); | 241 | GNUNET_assert (publish != NULL); |
246 | } | 242 | } |
247 | 243 | ||
248 | 244 | ||
249 | timeout_task = GNUNET_SCHEDULER_add_delayed (LIFETIME, | 245 | timeout_task = GNUNET_SCHEDULER_add_delayed (LIFETIME, |
250 | &abort_error, NULL); | 246 | &abort_error, NULL); |
251 | } | 247 | } |