aboutsummaryrefslogtreecommitdiff
path: root/src/fs/test_fs_download_indexed.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs/test_fs_download_indexed.c')
-rw-r--r--src/fs/test_fs_download_indexed.c27
1 files changed, 8 insertions, 19 deletions
diff --git a/src/fs/test_fs_download_indexed.c b/src/fs/test_fs_download_indexed.c
index 21d95d584..6e59f97cd 100644
--- a/src/fs/test_fs_download_indexed.c
+++ b/src/fs/test_fs_download_indexed.c
@@ -60,8 +60,6 @@ static struct PeerContext p1;
60 60
61static struct GNUNET_TIME_Absolute start; 61static struct GNUNET_TIME_Absolute start;
62 62
63static struct GNUNET_SCHEDULER_Handle *sched;
64
65static struct GNUNET_FS_Handle *fs; 63static struct GNUNET_FS_Handle *fs;
66 64
67static struct GNUNET_FS_DownloadContext *download; 65static struct GNUNET_FS_DownloadContext *download;
@@ -129,7 +127,7 @@ abort_download_task (void *cls,
129 GNUNET_DISK_directory_remove (fn); 127 GNUNET_DISK_directory_remove (fn);
130 GNUNET_free (fn); 128 GNUNET_free (fn);
131 fn = NULL; 129 fn = NULL;
132 GNUNET_SCHEDULER_cancel (sched, timeout_kill); 130 GNUNET_SCHEDULER_cancel (timeout_kill);
133 timeout_kill = GNUNET_SCHEDULER_NO_TASK; 131 timeout_kill = GNUNET_SCHEDULER_NO_TASK;
134} 132}
135 133
@@ -170,8 +168,7 @@ progress_cb (void *cls,
170 case GNUNET_FS_STATUS_DOWNLOAD_COMPLETED: 168 case GNUNET_FS_STATUS_DOWNLOAD_COMPLETED:
171 printf ("Download complete, %llu kbps.\n", 169 printf ("Download complete, %llu kbps.\n",
172 (unsigned long long) (FILESIZE * 1000LL / (1+GNUNET_TIME_absolute_get_duration (start).rel_value) / 1024LL)); 170 (unsigned long long) (FILESIZE * 1000LL / (1+GNUNET_TIME_absolute_get_duration (start).rel_value) / 1024LL));
173 GNUNET_SCHEDULER_add_now (sched, 171 GNUNET_SCHEDULER_add_now (&abort_download_task,
174 &abort_download_task,
175 NULL); 172 NULL);
176 break; 173 break;
177 case GNUNET_FS_STATUS_DOWNLOAD_PROGRESS: 174 case GNUNET_FS_STATUS_DOWNLOAD_PROGRESS:
@@ -189,8 +186,7 @@ progress_cb (void *cls,
189 "Error publishing file: %s\n", 186 "Error publishing file: %s\n",
190 event->value.publish.specifics.error.message); 187 event->value.publish.specifics.error.message);
191 GNUNET_break (0); 188 GNUNET_break (0);
192 GNUNET_SCHEDULER_add_continuation (sched, 189 GNUNET_SCHEDULER_add_continuation (&abort_publish_task,
193 &abort_publish_task,
194 NULL, 190 NULL,
195 GNUNET_SCHEDULER_REASON_PREREQ_DONE); 191 GNUNET_SCHEDULER_REASON_PREREQ_DONE);
196 break; 192 break;
@@ -198,8 +194,7 @@ progress_cb (void *cls,
198 fprintf (stderr, 194 fprintf (stderr,
199 "Error downloading file: %s\n", 195 "Error downloading file: %s\n",
200 event->value.download.specifics.error.message); 196 event->value.download.specifics.error.message);
201 GNUNET_SCHEDULER_add_now (sched, 197 GNUNET_SCHEDULER_add_now (&abort_download_task,
202 &abort_download_task,
203 NULL); 198 NULL);
204 break; 199 break;
205 case GNUNET_FS_STATUS_DOWNLOAD_ACTIVE: 200 case GNUNET_FS_STATUS_DOWNLOAD_ACTIVE:
@@ -216,8 +211,7 @@ progress_cb (void *cls,
216 GNUNET_assert (publish == event->value.publish.pc); 211 GNUNET_assert (publish == event->value.publish.pc);
217 GNUNET_assert (FILESIZE == event->value.publish.size); 212 GNUNET_assert (FILESIZE == event->value.publish.size);
218 GNUNET_assert (1 == event->value.publish.anonymity); 213 GNUNET_assert (1 == event->value.publish.anonymity);
219 GNUNET_SCHEDULER_add_now (sched, 214 GNUNET_SCHEDULER_add_now (&stop_fs_task,
220 &stop_fs_task,
221 NULL); 215 NULL);
222 break; 216 break;
223 case GNUNET_FS_STATUS_DOWNLOAD_START: 217 case GNUNET_FS_STATUS_DOWNLOAD_START:
@@ -232,8 +226,7 @@ progress_cb (void *cls,
232 break; 226 break;
233 case GNUNET_FS_STATUS_DOWNLOAD_STOPPED: 227 case GNUNET_FS_STATUS_DOWNLOAD_STOPPED:
234 GNUNET_assert (download == event->value.download.dc); 228 GNUNET_assert (download == event->value.download.dc);
235 GNUNET_SCHEDULER_add_continuation (sched, 229 GNUNET_SCHEDULER_add_continuation (&abort_publish_task,
236 &abort_publish_task,
237 NULL, 230 NULL,
238 GNUNET_SCHEDULER_REASON_PREREQ_DONE); 231 GNUNET_SCHEDULER_REASON_PREREQ_DONE);
239 break; 232 break;
@@ -281,7 +274,6 @@ stop_arm (struct PeerContext *p)
281 274
282static void 275static void
283run (void *cls, 276run (void *cls,
284 struct GNUNET_SCHEDULER_Handle *s,
285 char *const *args, 277 char *const *args,
286 const char *cfgfile, 278 const char *cfgfile,
287 const struct GNUNET_CONFIGURATION_Handle *cfg) 279 const struct GNUNET_CONFIGURATION_Handle *cfg)
@@ -296,10 +288,8 @@ run (void *cls,
296 struct GNUNET_FS_FileInformation *fi; 288 struct GNUNET_FS_FileInformation *fi;
297 size_t i; 289 size_t i;
298 290
299 sched = s;
300 setup_peer (&p1, "test_fs_download_data.conf"); 291 setup_peer (&p1, "test_fs_download_data.conf");
301 fs = GNUNET_FS_start (sched, 292 fs = GNUNET_FS_start (cfg,
302 cfg,
303 "test-fs-download-indexed", 293 "test-fs-download-indexed",
304 &progress_cb, 294 &progress_cb,
305 NULL, 295 NULL,
@@ -331,8 +321,7 @@ run (void *cls,
331 GNUNET_FS_uri_destroy (kuri); 321 GNUNET_FS_uri_destroy (kuri);
332 GNUNET_CONTAINER_meta_data_destroy (meta); 322 GNUNET_CONTAINER_meta_data_destroy (meta);
333 GNUNET_assert (NULL != fi); 323 GNUNET_assert (NULL != fi);
334 timeout_kill = GNUNET_SCHEDULER_add_delayed (sched, 324 timeout_kill = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
335 TIMEOUT,
336 &timeout_kill_task, 325 &timeout_kill_task,
337 NULL); 326 NULL);
338 start = GNUNET_TIME_absolute_get (); 327 start = GNUNET_TIME_absolute_get ();