diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-11-05 18:21:50 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-11-05 18:21:50 +0000 |
commit | 75a33a1499cf60ea4364c9aa673816629a6c1413 (patch) | |
tree | 0620da4312bb04de4d7b65074fdd3b0c3dd6cc0e /src/fs | |
parent | 7217c601ad30760872823193d62307e7a335d226 (diff) | |
download | gnunet-75a33a1499cf60ea4364c9aa673816629a6c1413.tar.gz gnunet-75a33a1499cf60ea4364c9aa673816629a6c1413.zip |
big scheduler refactoring, expect some issues
Diffstat (limited to 'src/fs')
38 files changed, 250 insertions, 626 deletions
diff --git a/src/fs/fs.c b/src/fs/fs.c index e144a0b89..736c3b026 100644 --- a/src/fs/fs.c +++ b/src/fs/fs.c | |||
@@ -40,7 +40,7 @@ | |||
40 | static void | 40 | static void |
41 | start_job (struct GNUNET_FS_QueueEntry *qe) | 41 | start_job (struct GNUNET_FS_QueueEntry *qe) |
42 | { | 42 | { |
43 | qe->client = GNUNET_CLIENT_connect (qe->h->sched, "fs", qe->h->cfg); | 43 | qe->client = GNUNET_CLIENT_connect ("fs", qe->h->cfg); |
44 | if (qe->client == NULL) | 44 | if (qe->client == NULL) |
45 | { | 45 | { |
46 | GNUNET_break (0); | 46 | GNUNET_break (0); |
@@ -138,8 +138,7 @@ process_job_queue (void *cls, | |||
138 | continue; | 138 | continue; |
139 | stop_job (qe); | 139 | stop_job (qe); |
140 | } | 140 | } |
141 | h->queue_job = GNUNET_SCHEDULER_add_delayed (h->sched, | 141 | h->queue_job = GNUNET_SCHEDULER_add_delayed (restart_at, |
142 | restart_at, | ||
143 | &process_job_queue, | 142 | &process_job_queue, |
144 | h); | 143 | h); |
145 | } | 144 | } |
@@ -176,11 +175,9 @@ GNUNET_FS_queue_ (struct GNUNET_FS_Handle *h, | |||
176 | h->pending_tail, | 175 | h->pending_tail, |
177 | qe); | 176 | qe); |
178 | if (h->queue_job != GNUNET_SCHEDULER_NO_TASK) | 177 | if (h->queue_job != GNUNET_SCHEDULER_NO_TASK) |
179 | GNUNET_SCHEDULER_cancel (h->sched, | 178 | GNUNET_SCHEDULER_cancel (h->queue_job); |
180 | h->queue_job); | ||
181 | h->queue_job | 179 | h->queue_job |
182 | = GNUNET_SCHEDULER_add_now (h->sched, | 180 | = GNUNET_SCHEDULER_add_now (&process_job_queue, |
183 | &process_job_queue, | ||
184 | h); | 181 | h); |
185 | return qe; | 182 | return qe; |
186 | } | 183 | } |
@@ -203,11 +200,9 @@ GNUNET_FS_dequeue_ (struct GNUNET_FS_QueueEntry *qh) | |||
203 | qh); | 200 | qh); |
204 | GNUNET_free (qh); | 201 | GNUNET_free (qh); |
205 | if (h->queue_job != GNUNET_SCHEDULER_NO_TASK) | 202 | if (h->queue_job != GNUNET_SCHEDULER_NO_TASK) |
206 | GNUNET_SCHEDULER_cancel (h->sched, | 203 | GNUNET_SCHEDULER_cancel (h->queue_job); |
207 | h->queue_job); | ||
208 | h->queue_job | 204 | h->queue_job |
209 | = GNUNET_SCHEDULER_add_now (h->sched, | 205 | = GNUNET_SCHEDULER_add_now (&process_job_queue, |
210 | &process_job_queue, | ||
211 | h); | 206 | h); |
212 | } | 207 | } |
213 | 208 | ||
@@ -1449,8 +1444,7 @@ deserialize_publish_file (void *cls, | |||
1449 | if ( (0 == (pc->options & GNUNET_FS_PUBLISH_OPTION_SIMULATE_ONLY)) && | 1444 | if ( (0 == (pc->options & GNUNET_FS_PUBLISH_OPTION_SIMULATE_ONLY)) && |
1450 | (GNUNET_YES != pc->all_done) ) | 1445 | (GNUNET_YES != pc->all_done) ) |
1451 | { | 1446 | { |
1452 | pc->dsh = GNUNET_DATASTORE_connect (h->cfg, | 1447 | pc->dsh = GNUNET_DATASTORE_connect (h->cfg); |
1453 | h->sched); | ||
1454 | if (NULL == pc->dsh) | 1448 | if (NULL == pc->dsh) |
1455 | goto cleanup; | 1449 | goto cleanup; |
1456 | } | 1450 | } |
@@ -1478,8 +1472,7 @@ deserialize_publish_file (void *cls, | |||
1478 | /* re-start publishing (if needed)... */ | 1472 | /* re-start publishing (if needed)... */ |
1479 | if (pc->all_done != GNUNET_YES) | 1473 | if (pc->all_done != GNUNET_YES) |
1480 | pc->upload_task | 1474 | pc->upload_task |
1481 | = GNUNET_SCHEDULER_add_with_priority (h->sched, | 1475 | = GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_BACKGROUND, |
1482 | GNUNET_SCHEDULER_PRIORITY_BACKGROUND, | ||
1483 | &GNUNET_FS_publish_main_, | 1476 | &GNUNET_FS_publish_main_, |
1484 | pc); | 1477 | pc); |
1485 | if (GNUNET_OK != | 1478 | if (GNUNET_OK != |
@@ -2092,8 +2085,7 @@ deserialize_unindex_file (void *cls, | |||
2092 | switch (uc->state) | 2085 | switch (uc->state) |
2093 | { | 2086 | { |
2094 | case UNINDEX_STATE_HASHING: | 2087 | case UNINDEX_STATE_HASHING: |
2095 | uc->fhc = GNUNET_CRYPTO_hash_file (uc->h->sched, | 2088 | uc->fhc = GNUNET_CRYPTO_hash_file (GNUNET_SCHEDULER_PRIORITY_IDLE, |
2096 | GNUNET_SCHEDULER_PRIORITY_IDLE, | ||
2097 | uc->filename, | 2089 | uc->filename, |
2098 | HASHING_BLOCKSIZE, | 2090 | HASHING_BLOCKSIZE, |
2099 | &GNUNET_FS_unindex_process_hash_, | 2091 | &GNUNET_FS_unindex_process_hash_, |
@@ -2937,7 +2929,6 @@ deserialization_master (const char *master_path, | |||
2937 | /** | 2929 | /** |
2938 | * Setup a connection to the file-sharing service. | 2930 | * Setup a connection to the file-sharing service. |
2939 | * | 2931 | * |
2940 | * @param sched scheduler to use | ||
2941 | * @param cfg configuration to use | 2932 | * @param cfg configuration to use |
2942 | * @param client_name unique identifier for this client | 2933 | * @param client_name unique identifier for this client |
2943 | * @param upcb function to call to notify about FS actions | 2934 | * @param upcb function to call to notify about FS actions |
@@ -2947,8 +2938,7 @@ deserialization_master (const char *master_path, | |||
2947 | * @return NULL on error | 2938 | * @return NULL on error |
2948 | */ | 2939 | */ |
2949 | struct GNUNET_FS_Handle * | 2940 | struct GNUNET_FS_Handle * |
2950 | GNUNET_FS_start (struct GNUNET_SCHEDULER_Handle *sched, | 2941 | GNUNET_FS_start (const struct GNUNET_CONFIGURATION_Handle *cfg, |
2951 | const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
2952 | const char *client_name, | 2942 | const char *client_name, |
2953 | GNUNET_FS_ProgressCallback upcb, | 2943 | GNUNET_FS_ProgressCallback upcb, |
2954 | void *upcb_cls, | 2944 | void *upcb_cls, |
@@ -2960,7 +2950,6 @@ GNUNET_FS_start (struct GNUNET_SCHEDULER_Handle *sched, | |||
2960 | va_list ap; | 2950 | va_list ap; |
2961 | 2951 | ||
2962 | ret = GNUNET_malloc (sizeof (struct GNUNET_FS_Handle)); | 2952 | ret = GNUNET_malloc (sizeof (struct GNUNET_FS_Handle)); |
2963 | ret->sched = sched; | ||
2964 | ret->cfg = cfg; | 2953 | ret->cfg = cfg; |
2965 | ret->client_name = GNUNET_strdup (client_name); | 2954 | ret->client_name = GNUNET_strdup (client_name); |
2966 | ret->upcb = upcb; | 2955 | ret->upcb = upcb; |
@@ -3021,8 +3010,7 @@ GNUNET_FS_stop (struct GNUNET_FS_Handle *h) | |||
3021 | while (h->top_head != NULL) | 3010 | while (h->top_head != NULL) |
3022 | h->top_head->ssf (h->top_head->ssf_cls); | 3011 | h->top_head->ssf (h->top_head->ssf_cls); |
3023 | if (h->queue_job != GNUNET_SCHEDULER_NO_TASK) | 3012 | if (h->queue_job != GNUNET_SCHEDULER_NO_TASK) |
3024 | GNUNET_SCHEDULER_cancel (h->sched, | 3013 | GNUNET_SCHEDULER_cancel (h->queue_job); |
3025 | h->queue_job); | ||
3026 | GNUNET_free (h->client_name); | 3014 | GNUNET_free (h->client_name); |
3027 | GNUNET_free (h); | 3015 | GNUNET_free (h); |
3028 | } | 3016 | } |
diff --git a/src/fs/fs.h b/src/fs/fs.h index 68ed2184e..ccd949c59 100644 --- a/src/fs/fs.h +++ b/src/fs/fs.h | |||
@@ -1172,11 +1172,6 @@ GNUNET_FS_end_top (struct GNUNET_FS_Handle *h, | |||
1172 | struct GNUNET_FS_Handle | 1172 | struct GNUNET_FS_Handle |
1173 | { | 1173 | { |
1174 | /** | 1174 | /** |
1175 | * Scheduler. | ||
1176 | */ | ||
1177 | struct GNUNET_SCHEDULER_Handle *sched; | ||
1178 | |||
1179 | /** | ||
1180 | * Configuration to use. | 1175 | * Configuration to use. |
1181 | */ | 1176 | */ |
1182 | const struct GNUNET_CONFIGURATION_Handle *cfg; | 1177 | const struct GNUNET_CONFIGURATION_Handle *cfg; |
diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c index b62620c3d..617e28103 100644 --- a/src/fs/fs_download.c +++ b/src/fs/fs_download.c | |||
@@ -1459,8 +1459,7 @@ do_reconnect (void *cls, | |||
1459 | struct GNUNET_CLIENT_Connection *client; | 1459 | struct GNUNET_CLIENT_Connection *client; |
1460 | 1460 | ||
1461 | dc->task = GNUNET_SCHEDULER_NO_TASK; | 1461 | dc->task = GNUNET_SCHEDULER_NO_TASK; |
1462 | client = GNUNET_CLIENT_connect (dc->h->sched, | 1462 | client = GNUNET_CLIENT_connect ("fs", |
1463 | "fs", | ||
1464 | dc->h->cfg); | 1463 | dc->h->cfg); |
1465 | if (NULL == client) | 1464 | if (NULL == client) |
1466 | { | 1465 | { |
@@ -1543,8 +1542,7 @@ try_reconnect (struct GNUNET_FS_DownloadContext *dc) | |||
1543 | "Will try to reconnect in 1s\n"); | 1542 | "Will try to reconnect in 1s\n"); |
1544 | #endif | 1543 | #endif |
1545 | dc->task | 1544 | dc->task |
1546 | = GNUNET_SCHEDULER_add_delayed (dc->h->sched, | 1545 | = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, |
1547 | GNUNET_TIME_UNIT_SECONDS, | ||
1548 | &do_reconnect, | 1546 | &do_reconnect, |
1549 | dc); | 1547 | dc); |
1550 | } | 1548 | } |
@@ -1658,8 +1656,7 @@ GNUNET_FS_download_signal_suspend_ (void *cls) | |||
1658 | pi.status = GNUNET_FS_STATUS_DOWNLOAD_SUSPEND; | 1656 | pi.status = GNUNET_FS_STATUS_DOWNLOAD_SUSPEND; |
1659 | GNUNET_FS_download_make_status_ (&pi, dc); | 1657 | GNUNET_FS_download_make_status_ (&pi, dc); |
1660 | if (GNUNET_SCHEDULER_NO_TASK != dc->task) | 1658 | if (GNUNET_SCHEDULER_NO_TASK != dc->task) |
1661 | GNUNET_SCHEDULER_cancel (dc->h->sched, | 1659 | GNUNET_SCHEDULER_cancel (dc->task); |
1662 | dc->task); | ||
1663 | GNUNET_CONTAINER_multihashmap_iterate (dc->active, | 1660 | GNUNET_CONTAINER_multihashmap_iterate (dc->active, |
1664 | &free_entry, | 1661 | &free_entry, |
1665 | NULL); | 1662 | NULL); |
@@ -1992,8 +1989,7 @@ GNUNET_FS_download_stop (struct GNUNET_FS_DownloadContext *dc, | |||
1992 | pi.status = GNUNET_FS_STATUS_DOWNLOAD_STOPPED; | 1989 | pi.status = GNUNET_FS_STATUS_DOWNLOAD_STOPPED; |
1993 | GNUNET_FS_download_make_status_ (&pi, dc); | 1990 | GNUNET_FS_download_make_status_ (&pi, dc); |
1994 | if (GNUNET_SCHEDULER_NO_TASK != dc->task) | 1991 | if (GNUNET_SCHEDULER_NO_TASK != dc->task) |
1995 | GNUNET_SCHEDULER_cancel (dc->h->sched, | 1992 | GNUNET_SCHEDULER_cancel (dc->task); |
1996 | dc->task); | ||
1997 | GNUNET_CONTAINER_multihashmap_iterate (dc->active, | 1993 | GNUNET_CONTAINER_multihashmap_iterate (dc->active, |
1998 | &free_entry, | 1994 | &free_entry, |
1999 | NULL); | 1995 | NULL); |
diff --git a/src/fs/fs_list_indexed.c b/src/fs/fs_list_indexed.c index 5850fd94e..fec127763 100644 --- a/src/fs/fs_list_indexed.c +++ b/src/fs/fs_list_indexed.c | |||
@@ -90,8 +90,7 @@ handle_index_info (void *cls, | |||
90 | _("Failed to receive response for `%s' request from `%s' service.\n"), | 90 | _("Failed to receive response for `%s' request from `%s' service.\n"), |
91 | "GET_INDEXED", | 91 | "GET_INDEXED", |
92 | "fs"); | 92 | "fs"); |
93 | GNUNET_SCHEDULER_add_continuation (gic->h->sched, | 93 | GNUNET_SCHEDULER_add_continuation (gic->cont, |
94 | gic->cont, | ||
95 | gic->cont_cls, | 94 | gic->cont_cls, |
96 | GNUNET_SCHEDULER_REASON_TIMEOUT); | 95 | GNUNET_SCHEDULER_REASON_TIMEOUT); |
97 | GNUNET_CLIENT_disconnect (gic->client, GNUNET_NO); | 96 | GNUNET_CLIENT_disconnect (gic->client, GNUNET_NO); |
@@ -101,8 +100,7 @@ handle_index_info (void *cls, | |||
101 | if (ntohs (msg->type) == GNUNET_MESSAGE_TYPE_FS_INDEX_LIST_END) | 100 | if (ntohs (msg->type) == GNUNET_MESSAGE_TYPE_FS_INDEX_LIST_END) |
102 | { | 101 | { |
103 | /* normal end-of-list */ | 102 | /* normal end-of-list */ |
104 | GNUNET_SCHEDULER_add_continuation (gic->h->sched, | 103 | GNUNET_SCHEDULER_add_continuation (gic->cont, |
105 | gic->cont, | ||
106 | gic->cont_cls, | 104 | gic->cont_cls, |
107 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 105 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
108 | GNUNET_CLIENT_disconnect (gic->client, GNUNET_NO); | 106 | GNUNET_CLIENT_disconnect (gic->client, GNUNET_NO); |
@@ -121,8 +119,7 @@ handle_index_info (void *cls, | |||
121 | _("Failed to receive valid response for `%s' request from `%s' service.\n"), | 119 | _("Failed to receive valid response for `%s' request from `%s' service.\n"), |
122 | "GET_INDEXED", | 120 | "GET_INDEXED", |
123 | "fs"); | 121 | "fs"); |
124 | GNUNET_SCHEDULER_add_continuation (gic->h->sched, | 122 | GNUNET_SCHEDULER_add_continuation (gic->cont, |
125 | gic->cont, | ||
126 | gic->cont_cls, | 123 | gic->cont_cls, |
127 | GNUNET_SCHEDULER_REASON_TIMEOUT); | 124 | GNUNET_SCHEDULER_REASON_TIMEOUT); |
128 | GNUNET_CLIENT_disconnect (gic->client, GNUNET_NO); | 125 | GNUNET_CLIENT_disconnect (gic->client, GNUNET_NO); |
@@ -134,8 +131,7 @@ handle_index_info (void *cls, | |||
134 | filename, | 131 | filename, |
135 | &iim->file_id)) | 132 | &iim->file_id)) |
136 | { | 133 | { |
137 | GNUNET_SCHEDULER_add_continuation (gic->h->sched, | 134 | GNUNET_SCHEDULER_add_continuation (gic->cont, |
138 | gic->cont, | ||
139 | gic->cont_cls, | 135 | gic->cont_cls, |
140 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 136 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
141 | GNUNET_CLIENT_disconnect (gic->client, GNUNET_NO); | 137 | GNUNET_CLIENT_disconnect (gic->client, GNUNET_NO); |
@@ -172,16 +168,14 @@ GNUNET_FS_get_indexed_files (struct GNUNET_FS_Handle *h, | |||
172 | struct GetIndexedContext *gic; | 168 | struct GetIndexedContext *gic; |
173 | struct GNUNET_MessageHeader msg; | 169 | struct GNUNET_MessageHeader msg; |
174 | 170 | ||
175 | client = GNUNET_CLIENT_connect (h->sched, | 171 | client = GNUNET_CLIENT_connect ("fs", |
176 | "fs", | ||
177 | h->cfg); | 172 | h->cfg); |
178 | if (NULL == client) | 173 | if (NULL == client) |
179 | { | 174 | { |
180 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 175 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
181 | _("Failed to not connect to `%s' service.\n"), | 176 | _("Failed to not connect to `%s' service.\n"), |
182 | "fs"); | 177 | "fs"); |
183 | GNUNET_SCHEDULER_add_continuation (h->sched, | 178 | GNUNET_SCHEDULER_add_continuation (cont, |
184 | cont, | ||
185 | cont_cls, | 179 | cont_cls, |
186 | GNUNET_SCHEDULER_REASON_TIMEOUT); | 180 | GNUNET_SCHEDULER_REASON_TIMEOUT); |
187 | return; | 181 | return; |
diff --git a/src/fs/fs_namespace.c b/src/fs/fs_namespace.c index 5c1137eb7..91502e1de 100644 --- a/src/fs/fs_namespace.c +++ b/src/fs/fs_namespace.c | |||
@@ -265,11 +265,6 @@ struct AdvertisementContext | |||
265 | struct GNUNET_DATASTORE_Handle *dsh; | 265 | struct GNUNET_DATASTORE_Handle *dsh; |
266 | 266 | ||
267 | /** | 267 | /** |
268 | * Our scheduler. | ||
269 | */ | ||
270 | struct GNUNET_SCHEDULER_Handle *sched; | ||
271 | |||
272 | /** | ||
273 | * Our KSK URI. | 268 | * Our KSK URI. |
274 | */ | 269 | */ |
275 | struct GNUNET_FS_Uri *ksk_uri; | 270 | struct GNUNET_FS_Uri *ksk_uri; |
@@ -357,8 +352,7 @@ advertisement_cont (void *cls, | |||
357 | if (GNUNET_OK != success) | 352 | if (GNUNET_OK != success) |
358 | { | 353 | { |
359 | /* error! */ | 354 | /* error! */ |
360 | GNUNET_SCHEDULER_add_continuation (ac->sched, | 355 | GNUNET_SCHEDULER_add_continuation (&do_disconnect, |
361 | &do_disconnect, | ||
362 | ac->dsh, | 356 | ac->dsh, |
363 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 357 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
364 | if (ac->cont != NULL) | 358 | if (ac->cont != NULL) |
@@ -373,8 +367,7 @@ advertisement_cont (void *cls, | |||
373 | if (ac->pos == ac->ksk_uri->data.ksk.keywordCount) | 367 | if (ac->pos == ac->ksk_uri->data.ksk.keywordCount) |
374 | { | 368 | { |
375 | /* done! */ | 369 | /* done! */ |
376 | GNUNET_SCHEDULER_add_continuation (ac->sched, | 370 | GNUNET_SCHEDULER_add_continuation (&do_disconnect, |
377 | &do_disconnect, | ||
378 | ac->dsh, | 371 | ac->dsh, |
379 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 372 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
380 | if (ac->cont != NULL) | 373 | if (ac->cont != NULL) |
@@ -501,7 +494,7 @@ GNUNET_FS_namespace_advertise (struct GNUNET_FS_Handle *h, | |||
501 | nb->ns_purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_FS_NBLOCK); | 494 | nb->ns_purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_FS_NBLOCK); |
502 | nb->ksk_purpose.size = htonl (size - sizeof (struct GNUNET_CRYPTO_RsaSignature)); | 495 | nb->ksk_purpose.size = htonl (size - sizeof (struct GNUNET_CRYPTO_RsaSignature)); |
503 | nb->ksk_purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_FS_NBLOCK_KSIG); | 496 | nb->ksk_purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_FS_NBLOCK_KSIG); |
504 | dsh = GNUNET_DATASTORE_connect (h->cfg, h->sched); | 497 | dsh = GNUNET_DATASTORE_connect (h->cfg); |
505 | if (NULL == dsh) | 498 | if (NULL == dsh) |
506 | { | 499 | { |
507 | GNUNET_free (nb); | 500 | GNUNET_free (nb); |
@@ -513,7 +506,6 @@ GNUNET_FS_namespace_advertise (struct GNUNET_FS_Handle *h, | |||
513 | ctx->cont = cont; | 506 | ctx->cont = cont; |
514 | ctx->cont_cls = cont_cls; | 507 | ctx->cont_cls = cont_cls; |
515 | ctx->dsh = dsh; | 508 | ctx->dsh = dsh; |
516 | ctx->sched = h->sched; | ||
517 | ctx->ksk_uri = GNUNET_FS_uri_dup (ksk_uri); | 509 | ctx->ksk_uri = GNUNET_FS_uri_dup (ksk_uri); |
518 | ctx->nb = nb; | 510 | ctx->nb = nb; |
519 | ctx->pt = pt; | 511 | ctx->pt = pt; |
@@ -956,7 +948,7 @@ GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, | |||
956 | NULL); | 948 | NULL); |
957 | return; | 949 | return; |
958 | } | 950 | } |
959 | psc->dsh = GNUNET_DATASTORE_connect (h->cfg, h->sched); | 951 | psc->dsh = GNUNET_DATASTORE_connect (h->cfg); |
960 | if (NULL == psc->dsh) | 952 | if (NULL == psc->dsh) |
961 | { | 953 | { |
962 | GNUNET_free (sb_enc); | 954 | GNUNET_free (sb_enc); |
diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c index ad2258b16..5c1cd0ea2 100644 --- a/src/fs/fs_publish.c +++ b/src/fs/fs_publish.c | |||
@@ -154,8 +154,7 @@ ds_put_cont (void *cls, | |||
154 | if (GNUNET_SYSERR == pcc->sc->in_network_wait) | 154 | if (GNUNET_SYSERR == pcc->sc->in_network_wait) |
155 | { | 155 | { |
156 | /* we were aborted in the meantime, finish shutdown! */ | 156 | /* we were aborted in the meantime, finish shutdown! */ |
157 | GNUNET_SCHEDULER_add_continuation (pcc->sc->h->sched, | 157 | GNUNET_SCHEDULER_add_continuation (&publish_cleanup, |
158 | &publish_cleanup, | ||
159 | pcc->sc, | 158 | pcc->sc, |
160 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 159 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
161 | GNUNET_free (pcc); | 160 | GNUNET_free (pcc); |
@@ -184,8 +183,7 @@ ds_put_cont (void *cls, | |||
184 | } | 183 | } |
185 | if (NULL != pcc->cont) | 184 | if (NULL != pcc->cont) |
186 | pcc->sc->upload_task | 185 | pcc->sc->upload_task |
187 | = GNUNET_SCHEDULER_add_with_priority (pcc->sc->h->sched, | 186 | = GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_BACKGROUND, |
188 | GNUNET_SCHEDULER_PRIORITY_BACKGROUND, | ||
189 | pcc->cont, | 187 | pcc->cont, |
190 | pcc->cont_cls); | 188 | pcc->cont_cls); |
191 | GNUNET_free (pcc); | 189 | GNUNET_free (pcc); |
@@ -365,8 +363,7 @@ publish_kblocks_cont (void *cls, | |||
365 | GNUNET_FS_file_information_sync_ (p); | 363 | GNUNET_FS_file_information_sync_ (p); |
366 | GNUNET_FS_publish_sync_ (pc); | 364 | GNUNET_FS_publish_sync_ (pc); |
367 | pc->upload_task | 365 | pc->upload_task |
368 | = GNUNET_SCHEDULER_add_with_priority (pc->h->sched, | 366 | = GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_BACKGROUND, |
369 | GNUNET_SCHEDULER_PRIORITY_BACKGROUND, | ||
370 | &GNUNET_FS_publish_main_, | 367 | &GNUNET_FS_publish_main_, |
371 | pc); | 368 | pc); |
372 | return; | 369 | return; |
@@ -384,8 +381,7 @@ publish_kblocks_cont (void *cls, | |||
384 | pc->fi_pos = p->dir; | 381 | pc->fi_pos = p->dir; |
385 | GNUNET_FS_publish_sync_ (pc); | 382 | GNUNET_FS_publish_sync_ (pc); |
386 | pc->upload_task | 383 | pc->upload_task |
387 | = GNUNET_SCHEDULER_add_with_priority (pc->h->sched, | 384 | = GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_BACKGROUND, |
388 | GNUNET_SCHEDULER_PRIORITY_BACKGROUND, | ||
389 | &GNUNET_FS_publish_main_, | 385 | &GNUNET_FS_publish_main_, |
390 | pc); | 386 | pc); |
391 | } | 387 | } |
@@ -498,8 +494,7 @@ encode_cont (void *cls, | |||
498 | 494 | ||
499 | /* continue with main */ | 495 | /* continue with main */ |
500 | sc->upload_task | 496 | sc->upload_task |
501 | = GNUNET_SCHEDULER_add_with_priority (sc->h->sched, | 497 | = GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_BACKGROUND, |
502 | GNUNET_SCHEDULER_PRIORITY_BACKGROUND, | ||
503 | &GNUNET_FS_publish_main_, | 498 | &GNUNET_FS_publish_main_, |
504 | sc); | 499 | sc); |
505 | } | 500 | } |
@@ -539,8 +534,7 @@ block_proc (void *cls, | |||
539 | "Waiting for datastore connection\n"); | 534 | "Waiting for datastore connection\n"); |
540 | #endif | 535 | #endif |
541 | sc->upload_task | 536 | sc->upload_task |
542 | = GNUNET_SCHEDULER_add_with_priority (sc->h->sched, | 537 | = GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_BACKGROUND, |
543 | GNUNET_SCHEDULER_PRIORITY_BACKGROUND, | ||
544 | &GNUNET_FS_publish_main_, | 538 | &GNUNET_FS_publish_main_, |
545 | sc); | 539 | sc); |
546 | return; | 540 | return; |
@@ -841,8 +835,7 @@ hash_for_index_cb (void *cls, | |||
841 | p->filename, | 835 | p->filename, |
842 | GNUNET_h2s (res)); | 836 | GNUNET_h2s (res)); |
843 | #endif | 837 | #endif |
844 | client = GNUNET_CLIENT_connect (sc->h->sched, | 838 | client = GNUNET_CLIENT_connect ("fs", |
845 | "fs", | ||
846 | sc->h->cfg); | 839 | sc->h->cfg); |
847 | if (NULL == client) | 840 | if (NULL == client) |
848 | { | 841 | { |
@@ -1038,8 +1031,7 @@ GNUNET_FS_publish_main_ (void *cls, | |||
1038 | else | 1031 | else |
1039 | { | 1032 | { |
1040 | p->start_time = GNUNET_TIME_absolute_get (); | 1033 | p->start_time = GNUNET_TIME_absolute_get (); |
1041 | pc->fhc = GNUNET_CRYPTO_hash_file (pc->h->sched, | 1034 | pc->fhc = GNUNET_CRYPTO_hash_file (GNUNET_SCHEDULER_PRIORITY_IDLE, |
1042 | GNUNET_SCHEDULER_PRIORITY_IDLE, | ||
1043 | p->filename, | 1035 | p->filename, |
1044 | HASHING_BLOCKSIZE, | 1036 | HASHING_BLOCKSIZE, |
1045 | &hash_for_index_cb, | 1037 | &hash_for_index_cb, |
@@ -1180,7 +1172,7 @@ GNUNET_FS_publish_signal_suspend_ (void *cls) | |||
1180 | 1172 | ||
1181 | if (GNUNET_SCHEDULER_NO_TASK != pc->upload_task) | 1173 | if (GNUNET_SCHEDULER_NO_TASK != pc->upload_task) |
1182 | { | 1174 | { |
1183 | GNUNET_SCHEDULER_cancel (pc->h->sched, pc->upload_task); | 1175 | GNUNET_SCHEDULER_cancel (pc->upload_task); |
1184 | pc->upload_task = GNUNET_SCHEDULER_NO_TASK; | 1176 | pc->upload_task = GNUNET_SCHEDULER_NO_TASK; |
1185 | } | 1177 | } |
1186 | GNUNET_FS_file_information_inspect (pc->fi, | 1178 | GNUNET_FS_file_information_inspect (pc->fi, |
@@ -1220,8 +1212,7 @@ finish_reserve (void *cls, | |||
1220 | } | 1212 | } |
1221 | pc->rid = success; | 1213 | pc->rid = success; |
1222 | pc->upload_task | 1214 | pc->upload_task |
1223 | = GNUNET_SCHEDULER_add_with_priority (pc->h->sched, | 1215 | = GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_BACKGROUND, |
1224 | GNUNET_SCHEDULER_PRIORITY_BACKGROUND, | ||
1225 | &GNUNET_FS_publish_main_, | 1216 | &GNUNET_FS_publish_main_, |
1226 | pc); | 1217 | pc); |
1227 | } | 1218 | } |
@@ -1254,8 +1245,7 @@ GNUNET_FS_publish_start (struct GNUNET_FS_Handle *h, | |||
1254 | GNUNET_assert (NULL != h); | 1245 | GNUNET_assert (NULL != h); |
1255 | if (0 == (options & GNUNET_FS_PUBLISH_OPTION_SIMULATE_ONLY)) | 1246 | if (0 == (options & GNUNET_FS_PUBLISH_OPTION_SIMULATE_ONLY)) |
1256 | { | 1247 | { |
1257 | dsh = GNUNET_DATASTORE_connect (h->cfg, | 1248 | dsh = GNUNET_DATASTORE_connect (h->cfg); |
1258 | h->sched); | ||
1259 | if (NULL == dsh) | 1249 | if (NULL == dsh) |
1260 | return NULL; | 1250 | return NULL; |
1261 | } | 1251 | } |
@@ -1301,8 +1291,7 @@ GNUNET_FS_publish_start (struct GNUNET_FS_Handle *h, | |||
1301 | else | 1291 | else |
1302 | { | 1292 | { |
1303 | ret->upload_task | 1293 | ret->upload_task |
1304 | = GNUNET_SCHEDULER_add_with_priority (h->sched, | 1294 | = GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_BACKGROUND, |
1305 | GNUNET_SCHEDULER_PRIORITY_BACKGROUND, | ||
1306 | &GNUNET_FS_publish_main_, | 1295 | &GNUNET_FS_publish_main_, |
1307 | ret); | 1296 | ret); |
1308 | } | 1297 | } |
@@ -1382,7 +1371,7 @@ GNUNET_FS_publish_stop (struct GNUNET_FS_PublishContext *pc) | |||
1382 | } | 1371 | } |
1383 | if (GNUNET_SCHEDULER_NO_TASK != pc->upload_task) | 1372 | if (GNUNET_SCHEDULER_NO_TASK != pc->upload_task) |
1384 | { | 1373 | { |
1385 | GNUNET_SCHEDULER_cancel (pc->h->sched, pc->upload_task); | 1374 | GNUNET_SCHEDULER_cancel (pc->upload_task); |
1386 | pc->upload_task = GNUNET_SCHEDULER_NO_TASK; | 1375 | pc->upload_task = GNUNET_SCHEDULER_NO_TASK; |
1387 | } | 1376 | } |
1388 | if (pc->serialization != NULL) | 1377 | if (pc->serialization != NULL) |
@@ -1524,8 +1513,7 @@ kb_put_cont (void *cls, | |||
1524 | GNUNET_free (pkc); | 1513 | GNUNET_free (pkc); |
1525 | return; | 1514 | return; |
1526 | } | 1515 | } |
1527 | GNUNET_SCHEDULER_add_continuation (pkc->h->sched, | 1516 | GNUNET_SCHEDULER_add_continuation (&publish_ksk_cont, |
1528 | &publish_ksk_cont, | ||
1529 | pkc, | 1517 | pkc, |
1530 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 1518 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
1531 | } | 1519 | } |
@@ -1649,8 +1637,7 @@ GNUNET_FS_publish_ksk (struct GNUNET_FS_Handle *h, | |||
1649 | pkc->cont_cls = cont_cls; | 1637 | pkc->cont_cls = cont_cls; |
1650 | if (0 == (options & GNUNET_FS_PUBLISH_OPTION_SIMULATE_ONLY)) | 1638 | if (0 == (options & GNUNET_FS_PUBLISH_OPTION_SIMULATE_ONLY)) |
1651 | { | 1639 | { |
1652 | pkc->dsh = GNUNET_DATASTORE_connect (h->cfg, | 1640 | pkc->dsh = GNUNET_DATASTORE_connect (h->cfg); |
1653 | h->sched); | ||
1654 | if (pkc->dsh == NULL) | 1641 | if (pkc->dsh == NULL) |
1655 | { | 1642 | { |
1656 | cont (cont_cls, NULL, _("Could not connect to datastore.")); | 1643 | cont (cont_cls, NULL, _("Could not connect to datastore.")); |
@@ -1703,8 +1690,7 @@ GNUNET_FS_publish_ksk (struct GNUNET_FS_Handle *h, | |||
1703 | pkc->slen); | 1690 | pkc->slen); |
1704 | pkc->cpy->purpose.purpose = htonl(GNUNET_SIGNATURE_PURPOSE_FS_KBLOCK); | 1691 | pkc->cpy->purpose.purpose = htonl(GNUNET_SIGNATURE_PURPOSE_FS_KBLOCK); |
1705 | pkc->ksk_uri = GNUNET_FS_uri_dup (ksk_uri); | 1692 | pkc->ksk_uri = GNUNET_FS_uri_dup (ksk_uri); |
1706 | GNUNET_SCHEDULER_add_continuation (h->sched, | 1693 | GNUNET_SCHEDULER_add_continuation (&publish_ksk_cont, |
1707 | &publish_ksk_cont, | ||
1708 | pkc, | 1694 | pkc, |
1709 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 1695 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
1710 | } | 1696 | } |
diff --git a/src/fs/fs_search.c b/src/fs/fs_search.c index 16e1dd1d5..1ffd681aa 100644 --- a/src/fs/fs_search.c +++ b/src/fs/fs_search.c | |||
@@ -279,32 +279,27 @@ GNUNET_FS_search_probe_progress_ (void *cls, | |||
279 | case GNUNET_FS_STATUS_DOWNLOAD_ERROR: | 279 | case GNUNET_FS_STATUS_DOWNLOAD_ERROR: |
280 | if (sr->probe_cancel_task != GNUNET_SCHEDULER_NO_TASK) | 280 | if (sr->probe_cancel_task != GNUNET_SCHEDULER_NO_TASK) |
281 | { | 281 | { |
282 | GNUNET_SCHEDULER_cancel (sr->sc->h->sched, | 282 | GNUNET_SCHEDULER_cancel (sr->probe_cancel_task); |
283 | sr->probe_cancel_task); | ||
284 | sr->probe_cancel_task = GNUNET_SCHEDULER_NO_TASK; | 283 | sr->probe_cancel_task = GNUNET_SCHEDULER_NO_TASK; |
285 | } | 284 | } |
286 | sr->probe_cancel_task = GNUNET_SCHEDULER_add_delayed (sr->sc->h->sched, | 285 | sr->probe_cancel_task = GNUNET_SCHEDULER_add_delayed (sr->remaining_probe_time, |
287 | sr->remaining_probe_time, | ||
288 | &probe_failure_handler, | 286 | &probe_failure_handler, |
289 | sr); | 287 | sr); |
290 | break; | 288 | break; |
291 | case GNUNET_FS_STATUS_DOWNLOAD_COMPLETED: | 289 | case GNUNET_FS_STATUS_DOWNLOAD_COMPLETED: |
292 | if (sr->probe_cancel_task != GNUNET_SCHEDULER_NO_TASK) | 290 | if (sr->probe_cancel_task != GNUNET_SCHEDULER_NO_TASK) |
293 | { | 291 | { |
294 | GNUNET_SCHEDULER_cancel (sr->sc->h->sched, | 292 | GNUNET_SCHEDULER_cancel (sr->probe_cancel_task); |
295 | sr->probe_cancel_task); | ||
296 | sr->probe_cancel_task = GNUNET_SCHEDULER_NO_TASK; | 293 | sr->probe_cancel_task = GNUNET_SCHEDULER_NO_TASK; |
297 | } | 294 | } |
298 | sr->probe_cancel_task = GNUNET_SCHEDULER_add_delayed (sr->sc->h->sched, | 295 | sr->probe_cancel_task = GNUNET_SCHEDULER_add_delayed (sr->remaining_probe_time, |
299 | sr->remaining_probe_time, | ||
300 | &probe_success_handler, | 296 | &probe_success_handler, |
301 | sr); | 297 | sr); |
302 | break; | 298 | break; |
303 | case GNUNET_FS_STATUS_DOWNLOAD_STOPPED: | 299 | case GNUNET_FS_STATUS_DOWNLOAD_STOPPED: |
304 | if (sr->probe_cancel_task != GNUNET_SCHEDULER_NO_TASK) | 300 | if (sr->probe_cancel_task != GNUNET_SCHEDULER_NO_TASK) |
305 | { | 301 | { |
306 | GNUNET_SCHEDULER_cancel (sr->sc->h->sched, | 302 | GNUNET_SCHEDULER_cancel (sr->probe_cancel_task); |
307 | sr->probe_cancel_task); | ||
308 | sr->probe_cancel_task = GNUNET_SCHEDULER_NO_TASK; | 303 | sr->probe_cancel_task = GNUNET_SCHEDULER_NO_TASK; |
309 | } | 304 | } |
310 | sr = NULL; | 305 | sr = NULL; |
@@ -312,16 +307,14 @@ GNUNET_FS_search_probe_progress_ (void *cls, | |||
312 | case GNUNET_FS_STATUS_DOWNLOAD_ACTIVE: | 307 | case GNUNET_FS_STATUS_DOWNLOAD_ACTIVE: |
313 | GNUNET_assert (sr->probe_cancel_task == GNUNET_SCHEDULER_NO_TASK); | 308 | GNUNET_assert (sr->probe_cancel_task == GNUNET_SCHEDULER_NO_TASK); |
314 | sr->probe_active_time = GNUNET_TIME_absolute_get (); | 309 | sr->probe_active_time = GNUNET_TIME_absolute_get (); |
315 | sr->probe_cancel_task = GNUNET_SCHEDULER_add_delayed (sr->sc->h->sched, | 310 | sr->probe_cancel_task = GNUNET_SCHEDULER_add_delayed (sr->remaining_probe_time, |
316 | sr->remaining_probe_time, | ||
317 | &probe_failure_handler, | 311 | &probe_failure_handler, |
318 | sr); | 312 | sr); |
319 | break; | 313 | break; |
320 | case GNUNET_FS_STATUS_DOWNLOAD_INACTIVE: | 314 | case GNUNET_FS_STATUS_DOWNLOAD_INACTIVE: |
321 | if (sr->probe_cancel_task != GNUNET_SCHEDULER_NO_TASK) | 315 | if (sr->probe_cancel_task != GNUNET_SCHEDULER_NO_TASK) |
322 | { | 316 | { |
323 | GNUNET_SCHEDULER_cancel (sr->sc->h->sched, | 317 | GNUNET_SCHEDULER_cancel (sr->probe_cancel_task); |
324 | sr->probe_cancel_task); | ||
325 | sr->probe_cancel_task = GNUNET_SCHEDULER_NO_TASK; | 318 | sr->probe_cancel_task = GNUNET_SCHEDULER_NO_TASK; |
326 | } | 319 | } |
327 | dur = GNUNET_TIME_absolute_get_duration (sr->probe_active_time); | 320 | dur = GNUNET_TIME_absolute_get_duration (sr->probe_active_time); |
@@ -1022,8 +1015,7 @@ do_reconnect (void *cls, | |||
1022 | size_t size; | 1015 | size_t size; |
1023 | 1016 | ||
1024 | sc->task = GNUNET_SCHEDULER_NO_TASK; | 1017 | sc->task = GNUNET_SCHEDULER_NO_TASK; |
1025 | client = GNUNET_CLIENT_connect (sc->h->sched, | 1018 | client = GNUNET_CLIENT_connect ("fs", |
1026 | "fs", | ||
1027 | sc->h->cfg); | 1019 | sc->h->cfg); |
1028 | if (NULL == client) | 1020 | if (NULL == client) |
1029 | { | 1021 | { |
@@ -1060,8 +1052,7 @@ try_reconnect (struct GNUNET_FS_SearchContext *sc) | |||
1060 | sc->client = NULL; | 1052 | sc->client = NULL; |
1061 | } | 1053 | } |
1062 | sc->task | 1054 | sc->task |
1063 | = GNUNET_SCHEDULER_add_delayed (sc->h->sched, | 1055 | = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, |
1064 | GNUNET_TIME_UNIT_SECONDS, | ||
1065 | &do_reconnect, | 1056 | &do_reconnect, |
1066 | sc); | 1057 | sc); |
1067 | } | 1058 | } |
@@ -1176,8 +1167,7 @@ GNUNET_FS_search_start_searching_ (struct GNUNET_FS_SearchContext *sc) | |||
1176 | &sc->requests[i].key); | 1167 | &sc->requests[i].key); |
1177 | } | 1168 | } |
1178 | } | 1169 | } |
1179 | sc->client = GNUNET_CLIENT_connect (sc->h->sched, | 1170 | sc->client = GNUNET_CLIENT_connect ("fs", |
1180 | "fs", | ||
1181 | sc->h->cfg); | 1171 | sc->h->cfg); |
1182 | if (NULL == sc->client) | 1172 | if (NULL == sc->client) |
1183 | return GNUNET_SYSERR; | 1173 | return GNUNET_SYSERR; |
@@ -1204,8 +1194,6 @@ search_result_freeze_probes (void *cls, | |||
1204 | const GNUNET_HashCode * key, | 1194 | const GNUNET_HashCode * key, |
1205 | void *value) | 1195 | void *value) |
1206 | { | 1196 | { |
1207 | struct GNUNET_FS_SearchContext *sc = cls; | ||
1208 | struct GNUNET_FS_Handle *h = sc->h; | ||
1209 | struct GNUNET_FS_SearchResult *sr = value; | 1197 | struct GNUNET_FS_SearchResult *sr = value; |
1210 | 1198 | ||
1211 | if (sr->probe_ctx != NULL) | 1199 | if (sr->probe_ctx != NULL) |
@@ -1215,8 +1203,7 @@ search_result_freeze_probes (void *cls, | |||
1215 | } | 1203 | } |
1216 | if (sr->probe_cancel_task != GNUNET_SCHEDULER_NO_TASK) | 1204 | if (sr->probe_cancel_task != GNUNET_SCHEDULER_NO_TASK) |
1217 | { | 1205 | { |
1218 | GNUNET_SCHEDULER_cancel (h->sched, | 1206 | GNUNET_SCHEDULER_cancel (sr->probe_cancel_task); |
1219 | sr->probe_cancel_task); | ||
1220 | sr->probe_cancel_task = GNUNET_SCHEDULER_NO_TASK; | 1207 | sr->probe_cancel_task = GNUNET_SCHEDULER_NO_TASK; |
1221 | } | 1208 | } |
1222 | if (sr->update_search != NULL) | 1209 | if (sr->update_search != NULL) |
@@ -1261,7 +1248,6 @@ search_result_suspend (void *cls, | |||
1261 | void *value) | 1248 | void *value) |
1262 | { | 1249 | { |
1263 | struct GNUNET_FS_SearchContext *sc = cls; | 1250 | struct GNUNET_FS_SearchContext *sc = cls; |
1264 | struct GNUNET_FS_Handle *h = sc->h; | ||
1265 | struct GNUNET_FS_SearchResult *sr = value; | 1251 | struct GNUNET_FS_SearchResult *sr = value; |
1266 | struct GNUNET_FS_ProgressInfo pi; | 1252 | struct GNUNET_FS_ProgressInfo pi; |
1267 | 1253 | ||
@@ -1281,8 +1267,7 @@ search_result_suspend (void *cls, | |||
1281 | if (sr->probe_ctx != NULL) | 1267 | if (sr->probe_ctx != NULL) |
1282 | GNUNET_FS_download_stop (sr->probe_ctx, GNUNET_YES); | 1268 | GNUNET_FS_download_stop (sr->probe_ctx, GNUNET_YES); |
1283 | if (sr->probe_cancel_task != GNUNET_SCHEDULER_NO_TASK) | 1269 | if (sr->probe_cancel_task != GNUNET_SCHEDULER_NO_TASK) |
1284 | GNUNET_SCHEDULER_cancel (h->sched, | 1270 | GNUNET_SCHEDULER_cancel (sr->probe_cancel_task); |
1285 | sr->probe_cancel_task); | ||
1286 | GNUNET_free (sr); | 1271 | GNUNET_free (sr); |
1287 | return GNUNET_OK; | 1272 | return GNUNET_OK; |
1288 | } | 1273 | } |
@@ -1309,8 +1294,7 @@ GNUNET_FS_search_signal_suspend_ (void *cls) | |||
1309 | sc->client_info = GNUNET_FS_search_make_status_ (&pi, sc); | 1294 | sc->client_info = GNUNET_FS_search_make_status_ (&pi, sc); |
1310 | GNUNET_break (NULL == sc->client_info); | 1295 | GNUNET_break (NULL == sc->client_info); |
1311 | if (sc->task != GNUNET_SCHEDULER_NO_TASK) | 1296 | if (sc->task != GNUNET_SCHEDULER_NO_TASK) |
1312 | GNUNET_SCHEDULER_cancel (sc->h->sched, | 1297 | GNUNET_SCHEDULER_cancel (sc->task); |
1313 | sc->task); | ||
1314 | if (NULL != sc->client) | 1298 | if (NULL != sc->client) |
1315 | GNUNET_CLIENT_disconnect (sc->client, GNUNET_NO); | 1299 | GNUNET_CLIENT_disconnect (sc->client, GNUNET_NO); |
1316 | GNUNET_CONTAINER_multihashmap_destroy (sc->master_result_map); | 1300 | GNUNET_CONTAINER_multihashmap_destroy (sc->master_result_map); |
@@ -1366,8 +1350,7 @@ GNUNET_FS_search_pause (struct GNUNET_FS_SearchContext *sc) | |||
1366 | struct GNUNET_FS_ProgressInfo pi; | 1350 | struct GNUNET_FS_ProgressInfo pi; |
1367 | 1351 | ||
1368 | if (sc->task != GNUNET_SCHEDULER_NO_TASK) | 1352 | if (sc->task != GNUNET_SCHEDULER_NO_TASK) |
1369 | GNUNET_SCHEDULER_cancel (sc->h->sched, | 1353 | GNUNET_SCHEDULER_cancel (sc->task); |
1370 | sc->task); | ||
1371 | sc->task = GNUNET_SCHEDULER_NO_TASK; | 1354 | sc->task = GNUNET_SCHEDULER_NO_TASK; |
1372 | if (NULL != sc->client) | 1355 | if (NULL != sc->client) |
1373 | GNUNET_CLIENT_disconnect (sc->client, GNUNET_NO); | 1356 | GNUNET_CLIENT_disconnect (sc->client, GNUNET_NO); |
@@ -1417,7 +1400,6 @@ search_result_free (void *cls, | |||
1417 | void *value) | 1400 | void *value) |
1418 | { | 1401 | { |
1419 | struct GNUNET_FS_SearchContext *sc = cls; | 1402 | struct GNUNET_FS_SearchContext *sc = cls; |
1420 | struct GNUNET_FS_Handle *h = sc->h; | ||
1421 | struct GNUNET_FS_SearchResult *sr = value; | 1403 | struct GNUNET_FS_SearchResult *sr = value; |
1422 | struct GNUNET_FS_ProgressInfo pi; | 1404 | struct GNUNET_FS_ProgressInfo pi; |
1423 | 1405 | ||
@@ -1458,8 +1440,7 @@ search_result_free (void *cls, | |||
1458 | if (sr->probe_ctx != NULL) | 1440 | if (sr->probe_ctx != NULL) |
1459 | GNUNET_FS_download_stop (sr->probe_ctx, GNUNET_YES); | 1441 | GNUNET_FS_download_stop (sr->probe_ctx, GNUNET_YES); |
1460 | if (sr->probe_cancel_task != GNUNET_SCHEDULER_NO_TASK) | 1442 | if (sr->probe_cancel_task != GNUNET_SCHEDULER_NO_TASK) |
1461 | GNUNET_SCHEDULER_cancel (h->sched, | 1443 | GNUNET_SCHEDULER_cancel (sr->probe_cancel_task); |
1462 | sr->probe_cancel_task); | ||
1463 | GNUNET_free (sr); | 1444 | GNUNET_free (sr); |
1464 | return GNUNET_OK; | 1445 | return GNUNET_OK; |
1465 | } | 1446 | } |
@@ -1501,8 +1482,7 @@ GNUNET_FS_search_stop (struct GNUNET_FS_SearchContext *sc) | |||
1501 | sc->client_info = GNUNET_FS_search_make_status_ (&pi, sc); | 1482 | sc->client_info = GNUNET_FS_search_make_status_ (&pi, sc); |
1502 | GNUNET_break (NULL == sc->client_info); | 1483 | GNUNET_break (NULL == sc->client_info); |
1503 | if (sc->task != GNUNET_SCHEDULER_NO_TASK) | 1484 | if (sc->task != GNUNET_SCHEDULER_NO_TASK) |
1504 | GNUNET_SCHEDULER_cancel (sc->h->sched, | 1485 | GNUNET_SCHEDULER_cancel (sc->task); |
1505 | sc->task); | ||
1506 | if (NULL != sc->client) | 1486 | if (NULL != sc->client) |
1507 | GNUNET_CLIENT_disconnect (sc->client, GNUNET_NO); | 1487 | GNUNET_CLIENT_disconnect (sc->client, GNUNET_NO); |
1508 | GNUNET_CONTAINER_multihashmap_destroy (sc->master_result_map); | 1488 | GNUNET_CONTAINER_multihashmap_destroy (sc->master_result_map); |
diff --git a/src/fs/fs_test_lib.c b/src/fs/fs_test_lib.c index f91092c4e..b7f3cb55a 100644 --- a/src/fs/fs_test_lib.c +++ b/src/fs/fs_test_lib.c | |||
@@ -72,11 +72,6 @@ struct GNUNET_FS_TestDaemon | |||
72 | struct GNUNET_PeerIdentity id; | 72 | struct GNUNET_PeerIdentity id; |
73 | 73 | ||
74 | /** | 74 | /** |
75 | * Scheduler to use (for publish_cont). | ||
76 | */ | ||
77 | struct GNUNET_SCHEDULER_Handle *publish_sched; | ||
78 | |||
79 | /** | ||
80 | * Function to call when upload is done. | 75 | * Function to call when upload is done. |
81 | */ | 76 | */ |
82 | GNUNET_FS_TEST_UriContinuation publish_cont; | 77 | GNUNET_FS_TEST_UriContinuation publish_cont; |
@@ -112,11 +107,6 @@ struct GNUNET_FS_TestDaemon | |||
112 | char *publish_tmp_file; | 107 | char *publish_tmp_file; |
113 | 108 | ||
114 | /** | 109 | /** |
115 | * Scheduler to use (for download_cont). | ||
116 | */ | ||
117 | struct GNUNET_SCHEDULER_Handle *download_sched; | ||
118 | |||
119 | /** | ||
120 | * Function to call when download is done. | 110 | * Function to call when download is done. |
121 | */ | 111 | */ |
122 | GNUNET_SCHEDULER_Task download_cont; | 112 | GNUNET_SCHEDULER_Task download_cont; |
@@ -186,7 +176,6 @@ report_uri (void *cls, | |||
186 | 176 | ||
187 | GNUNET_FS_publish_stop (daemon->publish_context); | 177 | GNUNET_FS_publish_stop (daemon->publish_context); |
188 | daemon->publish_context = NULL; | 178 | daemon->publish_context = NULL; |
189 | daemon->publish_sched = NULL; | ||
190 | cont = daemon->publish_cont; | 179 | cont = daemon->publish_cont; |
191 | daemon->publish_cont = NULL; | 180 | daemon->publish_cont = NULL; |
192 | uri = daemon->publish_uri; | 181 | uri = daemon->publish_uri; |
@@ -204,12 +193,10 @@ report_success (void *cls, | |||
204 | 193 | ||
205 | GNUNET_FS_download_stop (daemon->download_context, GNUNET_YES); | 194 | GNUNET_FS_download_stop (daemon->download_context, GNUNET_YES); |
206 | daemon->download_context = NULL; | 195 | daemon->download_context = NULL; |
207 | GNUNET_SCHEDULER_add_continuation (daemon->download_sched, | 196 | GNUNET_SCHEDULER_add_continuation (daemon->download_cont, |
208 | daemon->download_cont, | ||
209 | daemon->download_cont_cls, | 197 | daemon->download_cont_cls, |
210 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 198 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
211 | daemon->download_cont = NULL; | 199 | daemon->download_cont = NULL; |
212 | daemon->download_sched = NULL; | ||
213 | } | 200 | } |
214 | 201 | ||
215 | 202 | ||
@@ -222,12 +209,10 @@ progress_cb (void *cls, | |||
222 | switch (info->status) | 209 | switch (info->status) |
223 | { | 210 | { |
224 | case GNUNET_FS_STATUS_PUBLISH_COMPLETED: | 211 | case GNUNET_FS_STATUS_PUBLISH_COMPLETED: |
225 | GNUNET_SCHEDULER_cancel (daemon->publish_sched, | 212 | GNUNET_SCHEDULER_cancel (daemon->publish_timeout_task); |
226 | daemon->publish_timeout_task); | ||
227 | daemon->publish_timeout_task = GNUNET_SCHEDULER_NO_TASK; | 213 | daemon->publish_timeout_task = GNUNET_SCHEDULER_NO_TASK; |
228 | daemon->publish_uri = GNUNET_FS_uri_dup (info->value.publish.specifics.completed.chk_uri); | 214 | daemon->publish_uri = GNUNET_FS_uri_dup (info->value.publish.specifics.completed.chk_uri); |
229 | GNUNET_SCHEDULER_add_continuation (daemon->publish_sched, | 215 | GNUNET_SCHEDULER_add_continuation (&report_uri, |
230 | &report_uri, | ||
231 | daemon, | 216 | daemon, |
232 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 217 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
233 | break; | 218 | break; |
@@ -246,11 +231,9 @@ progress_cb (void *cls, | |||
246 | (unsigned long long) info->value.download.size); | 231 | (unsigned long long) info->value.download.size); |
247 | break; | 232 | break; |
248 | case GNUNET_FS_STATUS_DOWNLOAD_COMPLETED: | 233 | case GNUNET_FS_STATUS_DOWNLOAD_COMPLETED: |
249 | GNUNET_SCHEDULER_cancel (daemon->download_sched, | 234 | GNUNET_SCHEDULER_cancel (daemon->download_timeout_task); |
250 | daemon->download_timeout_task); | ||
251 | daemon->download_timeout_task = GNUNET_SCHEDULER_NO_TASK; | 235 | daemon->download_timeout_task = GNUNET_SCHEDULER_NO_TASK; |
252 | GNUNET_SCHEDULER_add_continuation (daemon->download_sched, | 236 | GNUNET_SCHEDULER_add_continuation (&report_success, |
253 | &report_success, | ||
254 | daemon, | 237 | daemon, |
255 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 238 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
256 | break; | 239 | break; |
@@ -269,7 +252,6 @@ progress_cb (void *cls, | |||
269 | 252 | ||
270 | struct StartContext | 253 | struct StartContext |
271 | { | 254 | { |
272 | struct GNUNET_SCHEDULER_Handle *sched; | ||
273 | struct GNUNET_TIME_Relative timeout; | 255 | struct GNUNET_TIME_Relative timeout; |
274 | unsigned int total; | 256 | unsigned int total; |
275 | unsigned int have; | 257 | unsigned int have; |
@@ -317,17 +299,14 @@ notify_running (void *cls, | |||
317 | sctx->have++; | 299 | sctx->have++; |
318 | if (sctx->have == sctx->total) | 300 | if (sctx->have == sctx->total) |
319 | { | 301 | { |
320 | GNUNET_SCHEDULER_add_continuation (sctx->sched, | 302 | GNUNET_SCHEDULER_add_continuation (sctx->cont, |
321 | sctx->cont, | ||
322 | sctx->cont_cls, | 303 | sctx->cont_cls, |
323 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 304 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
324 | sctx->daemons[0]->gcfg = sctx->cfg; | 305 | sctx->daemons[0]->gcfg = sctx->cfg; |
325 | GNUNET_SCHEDULER_cancel (sctx->sched, | 306 | GNUNET_SCHEDULER_cancel (sctx->timeout_task); |
326 | sctx->timeout_task); | ||
327 | for (i=0;i<sctx->total;i++) | 307 | for (i=0;i<sctx->total;i++) |
328 | { | 308 | { |
329 | sctx->daemons[i]->fs = GNUNET_FS_start (sctx->sched, | 309 | sctx->daemons[i]->fs = GNUNET_FS_start (sctx->daemons[i]->cfg, |
330 | sctx->daemons[i]->cfg, | ||
331 | "<tester>", | 310 | "<tester>", |
332 | &progress_cb, | 311 | &progress_cb, |
333 | sctx->daemons[i], | 312 | sctx->daemons[i], |
@@ -360,8 +339,7 @@ start_timeout (void *cls, | |||
360 | sctx->daemons[i] = NULL; | 339 | sctx->daemons[i] = NULL; |
361 | } | 340 | } |
362 | GNUNET_CONFIGURATION_destroy (sctx->cfg); | 341 | GNUNET_CONFIGURATION_destroy (sctx->cfg); |
363 | GNUNET_SCHEDULER_add_continuation (sctx->sched, | 342 | GNUNET_SCHEDULER_add_continuation (sctx->cont, |
364 | sctx->cont, | ||
365 | sctx->cont_cls, | 343 | sctx->cont_cls, |
366 | GNUNET_SCHEDULER_REASON_TIMEOUT); | 344 | GNUNET_SCHEDULER_REASON_TIMEOUT); |
367 | GNUNET_free (sctx); | 345 | GNUNET_free (sctx); |
@@ -371,7 +349,6 @@ start_timeout (void *cls, | |||
371 | /** | 349 | /** |
372 | * Start daemons for testing. | 350 | * Start daemons for testing. |
373 | * | 351 | * |
374 | * @param sched scheduler to use | ||
375 | * @param template_cfg_file configuration template to use | 352 | * @param template_cfg_file configuration template to use |
376 | * @param timeout if this operation cannot be completed within the | 353 | * @param timeout if this operation cannot be completed within the |
377 | * given period, call the continuation with an error code | 354 | * given period, call the continuation with an error code |
@@ -382,8 +359,7 @@ start_timeout (void *cls, | |||
382 | * @param cont_cls closure for cont | 359 | * @param cont_cls closure for cont |
383 | */ | 360 | */ |
384 | void | 361 | void |
385 | GNUNET_FS_TEST_daemons_start (struct GNUNET_SCHEDULER_Handle *sched, | 362 | GNUNET_FS_TEST_daemons_start (const char *template_cfg_file, |
386 | const char *template_cfg_file, | ||
387 | struct GNUNET_TIME_Relative timeout, | 363 | struct GNUNET_TIME_Relative timeout, |
388 | unsigned int total, | 364 | unsigned int total, |
389 | struct GNUNET_FS_TestDaemon **daemons, | 365 | struct GNUNET_FS_TestDaemon **daemons, |
@@ -395,7 +371,6 @@ GNUNET_FS_TEST_daemons_start (struct GNUNET_SCHEDULER_Handle *sched, | |||
395 | 371 | ||
396 | GNUNET_assert (total > 0); | 372 | GNUNET_assert (total > 0); |
397 | sctx = GNUNET_malloc (sizeof (struct StartContext)); | 373 | sctx = GNUNET_malloc (sizeof (struct StartContext)); |
398 | sctx->sched = sched; | ||
399 | sctx->daemons = daemons; | 374 | sctx->daemons = daemons; |
400 | sctx->total = total; | 375 | sctx->total = total; |
401 | sctx->cont = cont; | 376 | sctx->cont = cont; |
@@ -408,16 +383,14 @@ GNUNET_FS_TEST_daemons_start (struct GNUNET_SCHEDULER_Handle *sched, | |||
408 | GNUNET_break (0); | 383 | GNUNET_break (0); |
409 | GNUNET_CONFIGURATION_destroy (sctx->cfg); | 384 | GNUNET_CONFIGURATION_destroy (sctx->cfg); |
410 | GNUNET_free (sctx); | 385 | GNUNET_free (sctx); |
411 | GNUNET_SCHEDULER_add_continuation (sched, | 386 | GNUNET_SCHEDULER_add_continuation (cont, |
412 | cont, | ||
413 | cont_cls, | 387 | cont_cls, |
414 | GNUNET_SCHEDULER_REASON_TIMEOUT); | 388 | GNUNET_SCHEDULER_REASON_TIMEOUT); |
415 | return; | 389 | return; |
416 | } | 390 | } |
417 | for (i=0;i<total;i++) | 391 | for (i=0;i<total;i++) |
418 | daemons[i] = GNUNET_malloc (sizeof (struct GNUNET_FS_TestDaemon)); | 392 | daemons[i] = GNUNET_malloc (sizeof (struct GNUNET_FS_TestDaemon)); |
419 | sctx->group = GNUNET_TESTING_daemons_start (sched, | 393 | sctx->group = GNUNET_TESTING_daemons_start (sctx->cfg, |
420 | sctx->cfg, | ||
421 | total, | 394 | total, |
422 | timeout, | 395 | timeout, |
423 | NULL, | 396 | NULL, |
@@ -426,8 +399,7 @@ GNUNET_FS_TEST_daemons_start (struct GNUNET_SCHEDULER_Handle *sched, | |||
426 | sctx, | 399 | sctx, |
427 | NULL, NULL, | 400 | NULL, NULL, |
428 | NULL); | 401 | NULL); |
429 | sctx->timeout_task = GNUNET_SCHEDULER_add_delayed (sched, | 402 | sctx->timeout_task = GNUNET_SCHEDULER_add_delayed (timeout, |
430 | timeout, | ||
431 | &start_timeout, | 403 | &start_timeout, |
432 | sctx); | 404 | sctx); |
433 | } | 405 | } |
@@ -435,7 +407,6 @@ GNUNET_FS_TEST_daemons_start (struct GNUNET_SCHEDULER_Handle *sched, | |||
435 | 407 | ||
436 | struct ConnectContext | 408 | struct ConnectContext |
437 | { | 409 | { |
438 | struct GNUNET_SCHEDULER_Handle *sched; | ||
439 | GNUNET_SCHEDULER_Task cont; | 410 | GNUNET_SCHEDULER_Task cont; |
440 | void *cont_cls; | 411 | void *cont_cls; |
441 | }; | 412 | }; |
@@ -472,8 +443,7 @@ notify_connection (void *cls, | |||
472 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 443 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
473 | "Failed to connect peers: %s\n", | 444 | "Failed to connect peers: %s\n", |
474 | emsg); | 445 | emsg); |
475 | GNUNET_SCHEDULER_add_continuation (cc->sched, | 446 | GNUNET_SCHEDULER_add_continuation (cc->cont, |
476 | cc->cont, | ||
477 | cc->cont_cls, | 447 | cc->cont_cls, |
478 | (emsg != NULL) | 448 | (emsg != NULL) |
479 | ? GNUNET_SCHEDULER_REASON_TIMEOUT | 449 | ? GNUNET_SCHEDULER_REASON_TIMEOUT |
@@ -485,7 +455,6 @@ notify_connection (void *cls, | |||
485 | /** | 455 | /** |
486 | * Connect two daemons for testing. | 456 | * Connect two daemons for testing. |
487 | * | 457 | * |
488 | * @param sched scheduler to use | ||
489 | * @param daemon1 first daemon to connect | 458 | * @param daemon1 first daemon to connect |
490 | * @param daemon2 second first daemon to connect | 459 | * @param daemon2 second first daemon to connect |
491 | * @param timeout if this operation cannot be completed within the | 460 | * @param timeout if this operation cannot be completed within the |
@@ -494,8 +463,7 @@ notify_connection (void *cls, | |||
494 | * @param cont_cls closure for cont | 463 | * @param cont_cls closure for cont |
495 | */ | 464 | */ |
496 | void | 465 | void |
497 | GNUNET_FS_TEST_daemons_connect (struct GNUNET_SCHEDULER_Handle *sched, | 466 | GNUNET_FS_TEST_daemons_connect (struct GNUNET_FS_TestDaemon *daemon1, |
498 | struct GNUNET_FS_TestDaemon *daemon1, | ||
499 | struct GNUNET_FS_TestDaemon *daemon2, | 467 | struct GNUNET_FS_TestDaemon *daemon2, |
500 | struct GNUNET_TIME_Relative timeout, | 468 | struct GNUNET_TIME_Relative timeout, |
501 | GNUNET_SCHEDULER_Task cont, | 469 | GNUNET_SCHEDULER_Task cont, |
@@ -504,7 +472,6 @@ GNUNET_FS_TEST_daemons_connect (struct GNUNET_SCHEDULER_Handle *sched, | |||
504 | struct ConnectContext *ncc; | 472 | struct ConnectContext *ncc; |
505 | 473 | ||
506 | ncc = GNUNET_malloc (sizeof (struct ConnectContext)); | 474 | ncc = GNUNET_malloc (sizeof (struct ConnectContext)); |
507 | ncc->sched = sched; | ||
508 | ncc->cont = cont; | 475 | ncc->cont = cont; |
509 | ncc->cont_cls = cont_cls; | 476 | ncc->cont_cls = cont_cls; |
510 | GNUNET_TESTING_daemons_connect (daemon1->daemon, | 477 | GNUNET_TESTING_daemons_connect (daemon1->daemon, |
@@ -546,13 +513,11 @@ GNUNET_FS_TEST_get_group (struct GNUNET_FS_TestDaemon **daemons) | |||
546 | /** | 513 | /** |
547 | * Stop daemons used for testing. | 514 | * Stop daemons used for testing. |
548 | * | 515 | * |
549 | * @param sched scheduler to use | ||
550 | * @param total number of daemons to stop | 516 | * @param total number of daemons to stop |
551 | * @param daemons array with the daemons (values will be clobbered) | 517 | * @param daemons array with the daemons (values will be clobbered) |
552 | */ | 518 | */ |
553 | void | 519 | void |
554 | GNUNET_FS_TEST_daemons_stop (struct GNUNET_SCHEDULER_Handle *sched, | 520 | GNUNET_FS_TEST_daemons_stop (unsigned int total, |
555 | unsigned int total, | ||
556 | struct GNUNET_FS_TestDaemon **daemons) | 521 | struct GNUNET_FS_TestDaemon **daemons) |
557 | { | 522 | { |
558 | unsigned int i; | 523 | unsigned int i; |
@@ -633,7 +598,6 @@ file_generator (void *cls, | |||
633 | /** | 598 | /** |
634 | * Publish a file at the given daemon. | 599 | * Publish a file at the given daemon. |
635 | * | 600 | * |
636 | * @param sched scheduler to use | ||
637 | * @param daemon where to publish | 601 | * @param daemon where to publish |
638 | * @param timeout if this operation cannot be completed within the | 602 | * @param timeout if this operation cannot be completed within the |
639 | * given period, call the continuation with an error code | 603 | * given period, call the continuation with an error code |
@@ -647,8 +611,7 @@ file_generator (void *cls, | |||
647 | * @param cont_cls closure for cont | 611 | * @param cont_cls closure for cont |
648 | */ | 612 | */ |
649 | void | 613 | void |
650 | GNUNET_FS_TEST_publish (struct GNUNET_SCHEDULER_Handle *sched, | 614 | GNUNET_FS_TEST_publish (struct GNUNET_FS_TestDaemon *daemon, |
651 | struct GNUNET_FS_TestDaemon *daemon, | ||
652 | struct GNUNET_TIME_Relative timeout, | 615 | struct GNUNET_TIME_Relative timeout, |
653 | uint32_t anonymity, | 616 | uint32_t anonymity, |
654 | int do_index, | 617 | int do_index, |
@@ -670,7 +633,6 @@ GNUNET_FS_TEST_publish (struct GNUNET_SCHEDULER_Handle *sched, | |||
670 | daemon->publish_cont_cls = cont_cls; | 633 | daemon->publish_cont_cls = cont_cls; |
671 | daemon->publish_seed = seed; | 634 | daemon->publish_seed = seed; |
672 | daemon->verbose = verbose; | 635 | daemon->verbose = verbose; |
673 | daemon->publish_sched = sched; | ||
674 | if (GNUNET_YES == do_index) | 636 | if (GNUNET_YES == do_index) |
675 | { | 637 | { |
676 | GNUNET_assert (daemon->publish_tmp_file == NULL); | 638 | GNUNET_assert (daemon->publish_tmp_file == NULL); |
@@ -727,8 +689,7 @@ GNUNET_FS_TEST_publish (struct GNUNET_SCHEDULER_Handle *sched, | |||
727 | fi, | 689 | fi, |
728 | NULL, NULL, NULL, | 690 | NULL, NULL, NULL, |
729 | GNUNET_FS_PUBLISH_OPTION_NONE); | 691 | GNUNET_FS_PUBLISH_OPTION_NONE); |
730 | daemon->publish_timeout_task = GNUNET_SCHEDULER_add_delayed (sched, | 692 | daemon->publish_timeout_task = GNUNET_SCHEDULER_add_delayed (timeout, |
731 | timeout, | ||
732 | &publish_timeout, | 693 | &publish_timeout, |
733 | daemon); | 694 | daemon); |
734 | } | 695 | } |
@@ -745,19 +706,16 @@ download_timeout (void *cls, | |||
745 | daemon->download_timeout_task = GNUNET_SCHEDULER_NO_TASK; | 706 | daemon->download_timeout_task = GNUNET_SCHEDULER_NO_TASK; |
746 | GNUNET_FS_download_stop (daemon->download_context, GNUNET_YES); | 707 | GNUNET_FS_download_stop (daemon->download_context, GNUNET_YES); |
747 | daemon->download_context = NULL; | 708 | daemon->download_context = NULL; |
748 | GNUNET_SCHEDULER_add_continuation (daemon->download_sched, | 709 | GNUNET_SCHEDULER_add_continuation (daemon->download_cont, |
749 | daemon->download_cont, | ||
750 | daemon->download_cont_cls, | 710 | daemon->download_cont_cls, |
751 | GNUNET_SCHEDULER_REASON_TIMEOUT); | 711 | GNUNET_SCHEDULER_REASON_TIMEOUT); |
752 | daemon->download_cont = NULL; | 712 | daemon->download_cont = NULL; |
753 | daemon->download_sched = NULL; | ||
754 | } | 713 | } |
755 | 714 | ||
756 | 715 | ||
757 | /** | 716 | /** |
758 | * Perform test download. | 717 | * Perform test download. |
759 | * | 718 | * |
760 | * @param sched scheduler to use | ||
761 | * @param daemon which peer to download from | 719 | * @param daemon which peer to download from |
762 | * @param timeout if this operation cannot be completed within the | 720 | * @param timeout if this operation cannot be completed within the |
763 | * given period, call the continuation with an error code | 721 | * given period, call the continuation with an error code |
@@ -769,8 +727,7 @@ download_timeout (void *cls, | |||
769 | * @param cont_cls closure for cont | 727 | * @param cont_cls closure for cont |
770 | */ | 728 | */ |
771 | void | 729 | void |
772 | GNUNET_FS_TEST_download (struct GNUNET_SCHEDULER_Handle *sched, | 730 | GNUNET_FS_TEST_download (struct GNUNET_FS_TestDaemon *daemon, |
773 | struct GNUNET_FS_TestDaemon *daemon, | ||
774 | struct GNUNET_TIME_Relative timeout, | 731 | struct GNUNET_TIME_Relative timeout, |
775 | uint32_t anonymity, | 732 | uint32_t anonymity, |
776 | uint32_t seed, | 733 | uint32_t seed, |
@@ -784,7 +741,6 @@ GNUNET_FS_TEST_download (struct GNUNET_SCHEDULER_Handle *sched, | |||
784 | GNUNET_assert (daemon->download_cont == NULL); | 741 | GNUNET_assert (daemon->download_cont == NULL); |
785 | size = GNUNET_FS_uri_chk_get_file_size (uri); | 742 | size = GNUNET_FS_uri_chk_get_file_size (uri); |
786 | daemon->verbose = verbose; | 743 | daemon->verbose = verbose; |
787 | daemon->download_sched = sched; | ||
788 | daemon->download_cont = cont; | 744 | daemon->download_cont = cont; |
789 | daemon->download_cont_cls = cont_cls; | 745 | daemon->download_cont_cls = cont_cls; |
790 | daemon->download_seed = seed; | 746 | daemon->download_seed = seed; |
@@ -798,8 +754,7 @@ GNUNET_FS_TEST_download (struct GNUNET_SCHEDULER_Handle *sched, | |||
798 | GNUNET_FS_DOWNLOAD_OPTION_NONE, | 754 | GNUNET_FS_DOWNLOAD_OPTION_NONE, |
799 | NULL, | 755 | NULL, |
800 | NULL); | 756 | NULL); |
801 | daemon->download_timeout_task = GNUNET_SCHEDULER_add_delayed (sched, | 757 | daemon->download_timeout_task = GNUNET_SCHEDULER_add_delayed (timeout, |
802 | timeout, | ||
803 | &download_timeout, | 758 | &download_timeout, |
804 | daemon); | 759 | daemon); |
805 | } | 760 | } |
diff --git a/src/fs/fs_test_lib.h b/src/fs/fs_test_lib.h index 666fad196..b348dfe78 100644 --- a/src/fs/fs_test_lib.h +++ b/src/fs/fs_test_lib.h | |||
@@ -41,7 +41,6 @@ struct GNUNET_FS_TestDaemon; | |||
41 | /** | 41 | /** |
42 | * Start daemons for testing. | 42 | * Start daemons for testing. |
43 | * | 43 | * |
44 | * @param sched scheduler to use | ||
45 | * @param template_cfg_file configuration template to use | 44 | * @param template_cfg_file configuration template to use |
46 | * @param timeout if this operation cannot be completed within the | 45 | * @param timeout if this operation cannot be completed within the |
47 | * given period, call the continuation with an error code | 46 | * given period, call the continuation with an error code |
@@ -55,8 +54,7 @@ struct GNUNET_FS_TestDaemon; | |||
55 | * @param cont_cls closure for cont | 54 | * @param cont_cls closure for cont |
56 | */ | 55 | */ |
57 | void | 56 | void |
58 | GNUNET_FS_TEST_daemons_start (struct GNUNET_SCHEDULER_Handle *sched, | 57 | GNUNET_FS_TEST_daemons_start (const char *template_cfg_file, |
59 | const char *template_cfg_file, | ||
60 | struct GNUNET_TIME_Relative timeout, | 58 | struct GNUNET_TIME_Relative timeout, |
61 | unsigned int total, | 59 | unsigned int total, |
62 | struct GNUNET_FS_TestDaemon **daemons, | 60 | struct GNUNET_FS_TestDaemon **daemons, |
@@ -67,7 +65,6 @@ GNUNET_FS_TEST_daemons_start (struct GNUNET_SCHEDULER_Handle *sched, | |||
67 | /** | 65 | /** |
68 | * Connect two daemons for testing. | 66 | * Connect two daemons for testing. |
69 | * | 67 | * |
70 | * @param sched scheduler to use | ||
71 | * @param daemon1 first daemon to connect | 68 | * @param daemon1 first daemon to connect |
72 | * @param daemon2 second first daemon to connect | 69 | * @param daemon2 second first daemon to connect |
73 | * @param timeout if this operation cannot be completed within the | 70 | * @param timeout if this operation cannot be completed within the |
@@ -76,8 +73,7 @@ GNUNET_FS_TEST_daemons_start (struct GNUNET_SCHEDULER_Handle *sched, | |||
76 | * @param cont_cls closure for cont | 73 | * @param cont_cls closure for cont |
77 | */ | 74 | */ |
78 | void | 75 | void |
79 | GNUNET_FS_TEST_daemons_connect (struct GNUNET_SCHEDULER_Handle *sched, | 76 | GNUNET_FS_TEST_daemons_connect (struct GNUNET_FS_TestDaemon *daemon1, |
80 | struct GNUNET_FS_TestDaemon *daemon1, | ||
81 | struct GNUNET_FS_TestDaemon *daemon2, | 77 | struct GNUNET_FS_TestDaemon *daemon2, |
82 | struct GNUNET_TIME_Relative timeout, | 78 | struct GNUNET_TIME_Relative timeout, |
83 | GNUNET_SCHEDULER_Task cont, | 79 | GNUNET_SCHEDULER_Task cont, |
@@ -109,13 +105,11 @@ GNUNET_FS_TEST_get_configuration (struct GNUNET_FS_TestDaemon **daemons, | |||
109 | /** | 105 | /** |
110 | * Stop daemons used for testing. | 106 | * Stop daemons used for testing. |
111 | * | 107 | * |
112 | * @param sched scheduler to use | ||
113 | * @param total number of daemons to stop | 108 | * @param total number of daemons to stop |
114 | * @param daemons array with the daemons (values will be clobbered) | 109 | * @param daemons array with the daemons (values will be clobbered) |
115 | */ | 110 | */ |
116 | void | 111 | void |
117 | GNUNET_FS_TEST_daemons_stop (struct GNUNET_SCHEDULER_Handle *sched, | 112 | GNUNET_FS_TEST_daemons_stop (unsigned int total, |
118 | unsigned int total, | ||
119 | struct GNUNET_FS_TestDaemon **daemons); | 113 | struct GNUNET_FS_TestDaemon **daemons); |
120 | 114 | ||
121 | 115 | ||
@@ -133,7 +127,6 @@ typedef void | |||
133 | /** | 127 | /** |
134 | * Publish a file at the given daemon. | 128 | * Publish a file at the given daemon. |
135 | * | 129 | * |
136 | * @param sched scheduler to use | ||
137 | * @param daemon where to publish | 130 | * @param daemon where to publish |
138 | * @param timeout if this operation cannot be completed within the | 131 | * @param timeout if this operation cannot be completed within the |
139 | * given period, call the continuation with an error code | 132 | * given period, call the continuation with an error code |
@@ -147,8 +140,7 @@ typedef void | |||
147 | * @param cont_cls closure for cont | 140 | * @param cont_cls closure for cont |
148 | */ | 141 | */ |
149 | void | 142 | void |
150 | GNUNET_FS_TEST_publish (struct GNUNET_SCHEDULER_Handle *sched, | 143 | GNUNET_FS_TEST_publish (struct GNUNET_FS_TestDaemon *daemon, |
151 | struct GNUNET_FS_TestDaemon *daemon, | ||
152 | struct GNUNET_TIME_Relative timeout, | 144 | struct GNUNET_TIME_Relative timeout, |
153 | uint32_t anonymity, | 145 | uint32_t anonymity, |
154 | int do_index, | 146 | int do_index, |
@@ -162,7 +154,6 @@ GNUNET_FS_TEST_publish (struct GNUNET_SCHEDULER_Handle *sched, | |||
162 | /** | 154 | /** |
163 | * Perform test download. | 155 | * Perform test download. |
164 | * | 156 | * |
165 | * @param sched scheduler to use | ||
166 | * @param daemon which peer to download from | 157 | * @param daemon which peer to download from |
167 | * @param timeout if this operation cannot be completed within the | 158 | * @param timeout if this operation cannot be completed within the |
168 | * given period, call the continuation with an error code | 159 | * given period, call the continuation with an error code |
@@ -174,8 +165,7 @@ GNUNET_FS_TEST_publish (struct GNUNET_SCHEDULER_Handle *sched, | |||
174 | * @param cont_cls closure for cont | 165 | * @param cont_cls closure for cont |
175 | */ | 166 | */ |
176 | void | 167 | void |
177 | GNUNET_FS_TEST_download (struct GNUNET_SCHEDULER_Handle *sched, | 168 | GNUNET_FS_TEST_download (struct GNUNET_FS_TestDaemon *daemon, |
178 | struct GNUNET_FS_TestDaemon *daemon, | ||
179 | struct GNUNET_TIME_Relative timeout, | 169 | struct GNUNET_TIME_Relative timeout, |
180 | uint32_t anonymity, | 170 | uint32_t anonymity, |
181 | uint32_t seed, | 171 | uint32_t seed, |
diff --git a/src/fs/fs_tree.c b/src/fs/fs_tree.c index 55f7b0e09..b38a9c382 100644 --- a/src/fs/fs_tree.c +++ b/src/fs/fs_tree.c | |||
@@ -329,8 +329,7 @@ void GNUNET_FS_tree_encoder_next (struct GNUNET_FS_TreeEncoder * te) | |||
329 | iob, | 329 | iob, |
330 | &te->emsg)) | 330 | &te->emsg)) |
331 | { | 331 | { |
332 | GNUNET_SCHEDULER_add_continuation (te->h->sched, | 332 | GNUNET_SCHEDULER_add_continuation (te->cont, |
333 | te->cont, | ||
334 | te->cls, | 333 | te->cls, |
335 | GNUNET_SCHEDULER_REASON_TIMEOUT); | 334 | GNUNET_SCHEDULER_REASON_TIMEOUT); |
336 | return; | 335 | return; |
@@ -350,8 +349,7 @@ void GNUNET_FS_tree_encoder_next (struct GNUNET_FS_TreeEncoder * te) | |||
350 | te->uri->type = chk; | 349 | te->uri->type = chk; |
351 | te->uri->data.chk.chk = te->chk_tree[0]; | 350 | te->uri->data.chk.chk = te->chk_tree[0]; |
352 | te->uri->data.chk.file_length = GNUNET_htonll (te->size); | 351 | te->uri->data.chk.file_length = GNUNET_htonll (te->size); |
353 | GNUNET_SCHEDULER_add_continuation (te->h->sched, | 352 | GNUNET_SCHEDULER_add_continuation (te->cont, |
354 | te->cont, | ||
355 | te->cls, | 353 | te->cls, |
356 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 354 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
357 | return; | 355 | return; |
diff --git a/src/fs/fs_unindex.c b/src/fs/fs_unindex.c index e4ac4efd6..b3bcd48bf 100644 --- a/src/fs/fs_unindex.c +++ b/src/fs/fs_unindex.c | |||
@@ -318,8 +318,7 @@ unindex_finish (void *cls, | |||
318 | uc->dsh = NULL; | 318 | uc->dsh = NULL; |
319 | uc->state = UNINDEX_STATE_FS_NOTIFY; | 319 | uc->state = UNINDEX_STATE_FS_NOTIFY; |
320 | GNUNET_FS_unindex_sync_ (uc); | 320 | GNUNET_FS_unindex_sync_ (uc); |
321 | uc->client = GNUNET_CLIENT_connect (uc->h->sched, | 321 | uc->client = GNUNET_CLIENT_connect ("fs", |
322 | "fs", | ||
323 | uc->h->cfg); | 322 | uc->h->cfg); |
324 | if (uc->client == NULL) | 323 | if (uc->client == NULL) |
325 | { | 324 | { |
@@ -355,8 +354,7 @@ unindex_finish (void *cls, | |||
355 | void | 354 | void |
356 | GNUNET_FS_unindex_do_remove_ (struct GNUNET_FS_UnindexContext *uc) | 355 | GNUNET_FS_unindex_do_remove_ (struct GNUNET_FS_UnindexContext *uc) |
357 | { | 356 | { |
358 | uc->dsh = GNUNET_DATASTORE_connect (uc->h->cfg, | 357 | uc->dsh = GNUNET_DATASTORE_connect (uc->h->cfg); |
359 | uc->h->sched); | ||
360 | if (NULL == uc->dsh) | 358 | if (NULL == uc->dsh) |
361 | { | 359 | { |
362 | uc->state = UNINDEX_STATE_ERROR; | 360 | uc->state = UNINDEX_STATE_ERROR; |
@@ -506,8 +504,7 @@ GNUNET_FS_unindex_start (struct GNUNET_FS_Handle *h, | |||
506 | pi.status = GNUNET_FS_STATUS_UNINDEX_START; | 504 | pi.status = GNUNET_FS_STATUS_UNINDEX_START; |
507 | pi.value.unindex.eta = GNUNET_TIME_UNIT_FOREVER_REL; | 505 | pi.value.unindex.eta = GNUNET_TIME_UNIT_FOREVER_REL; |
508 | GNUNET_FS_unindex_make_status_ (&pi, ret, 0); | 506 | GNUNET_FS_unindex_make_status_ (&pi, ret, 0); |
509 | ret->fhc = GNUNET_CRYPTO_hash_file (h->sched, | 507 | ret->fhc = GNUNET_CRYPTO_hash_file (GNUNET_SCHEDULER_PRIORITY_IDLE, |
510 | GNUNET_SCHEDULER_PRIORITY_IDLE, | ||
511 | filename, | 508 | filename, |
512 | HASHING_BLOCKSIZE, | 509 | HASHING_BLOCKSIZE, |
513 | &GNUNET_FS_unindex_process_hash_, | 510 | &GNUNET_FS_unindex_process_hash_, |
diff --git a/src/fs/gnunet-directory.c b/src/fs/gnunet-directory.c index 8f58025c5..6de8206f1 100644 --- a/src/fs/gnunet-directory.c +++ b/src/fs/gnunet-directory.c | |||
@@ -106,14 +106,12 @@ print_entry (void *cls, | |||
106 | * Main function that will be run by the scheduler. | 106 | * Main function that will be run by the scheduler. |
107 | * | 107 | * |
108 | * @param cls closure | 108 | * @param cls closure |
109 | * @param sched the scheduler to use | ||
110 | * @param args remaining command-line arguments | 109 | * @param args remaining command-line arguments |
111 | * @param cfgfile name of the configuration file used (for saving, can be NULL!) | 110 | * @param cfgfile name of the configuration file used (for saving, can be NULL!) |
112 | * @param cfg configuration | 111 | * @param cfg configuration |
113 | */ | 112 | */ |
114 | static void | 113 | static void |
115 | run (void *cls, | 114 | run (void *cls, |
116 | struct GNUNET_SCHEDULER_Handle *sched, | ||
117 | char *const *args, | 115 | char *const *args, |
118 | const char *cfgfile, | 116 | const char *cfgfile, |
119 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 117 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
diff --git a/src/fs/gnunet-download.c b/src/fs/gnunet-download.c index 36681e407..99ebb1435 100644 --- a/src/fs/gnunet-download.c +++ b/src/fs/gnunet-download.c | |||
@@ -38,8 +38,6 @@ static const struct GNUNET_CONFIGURATION_Handle *cfg; | |||
38 | 38 | ||
39 | static struct GNUNET_FS_Handle *ctx; | 39 | static struct GNUNET_FS_Handle *ctx; |
40 | 40 | ||
41 | static struct GNUNET_SCHEDULER_Handle *sched; | ||
42 | |||
43 | static struct GNUNET_FS_DownloadContext *dc; | 41 | static struct GNUNET_FS_DownloadContext *dc; |
44 | 42 | ||
45 | static unsigned int anonymity = 1; | 43 | static unsigned int anonymity = 1; |
@@ -122,7 +120,7 @@ progress_cb (void *cls, | |||
122 | fprintf (stderr, | 120 | fprintf (stderr, |
123 | _("Error downloading: %s.\n"), | 121 | _("Error downloading: %s.\n"), |
124 | info->value.download.specifics.error.message); | 122 | info->value.download.specifics.error.message); |
125 | GNUNET_SCHEDULER_shutdown (sched); | 123 | GNUNET_SCHEDULER_shutdown (); |
126 | break; | 124 | break; |
127 | case GNUNET_FS_STATUS_DOWNLOAD_COMPLETED: | 125 | case GNUNET_FS_STATUS_DOWNLOAD_COMPLETED: |
128 | s = GNUNET_STRINGS_byte_size_fancy(info->value.download.completed * 1000 / (info->value.download.duration.rel_value + 1)); | 126 | s = GNUNET_STRINGS_byte_size_fancy(info->value.download.completed * 1000 / (info->value.download.duration.rel_value + 1)); |
@@ -132,12 +130,11 @@ progress_cb (void *cls, | |||
132 | s); | 130 | s); |
133 | GNUNET_free (s); | 131 | GNUNET_free (s); |
134 | if (info->value.download.dc == dc) | 132 | if (info->value.download.dc == dc) |
135 | GNUNET_SCHEDULER_shutdown (sched); | 133 | GNUNET_SCHEDULER_shutdown (); |
136 | break; | 134 | break; |
137 | case GNUNET_FS_STATUS_DOWNLOAD_STOPPED: | 135 | case GNUNET_FS_STATUS_DOWNLOAD_STOPPED: |
138 | if (info->value.download.dc == dc) | 136 | if (info->value.download.dc == dc) |
139 | GNUNET_SCHEDULER_add_continuation (sched, | 137 | GNUNET_SCHEDULER_add_continuation (&cleanup_task, |
140 | &cleanup_task, | ||
141 | NULL, | 138 | NULL, |
142 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 139 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
143 | break; | 140 | break; |
@@ -158,14 +155,12 @@ progress_cb (void *cls, | |||
158 | * Main function that will be run by the scheduler. | 155 | * Main function that will be run by the scheduler. |
159 | * | 156 | * |
160 | * @param cls closure | 157 | * @param cls closure |
161 | * @param s the scheduler to use | ||
162 | * @param args remaining command-line arguments | 158 | * @param args remaining command-line arguments |
163 | * @param cfgfile name of the configuration file used (for saving, can be NULL!) | 159 | * @param cfgfile name of the configuration file used (for saving, can be NULL!) |
164 | * @param c configuration | 160 | * @param c configuration |
165 | */ | 161 | */ |
166 | static void | 162 | static void |
167 | run (void *cls, | 163 | run (void *cls, |
168 | struct GNUNET_SCHEDULER_Handle *s, | ||
169 | char *const *args, | 164 | char *const *args, |
170 | const char *cfgfile, | 165 | const char *cfgfile, |
171 | const struct GNUNET_CONFIGURATION_Handle *c) | 166 | const struct GNUNET_CONFIGURATION_Handle *c) |
@@ -174,7 +169,6 @@ run (void *cls, | |||
174 | char *emsg; | 169 | char *emsg; |
175 | enum GNUNET_FS_DownloadOptions options; | 170 | enum GNUNET_FS_DownloadOptions options; |
176 | 171 | ||
177 | sched = s; | ||
178 | uri = GNUNET_FS_uri_parse (args[0], | 172 | uri = GNUNET_FS_uri_parse (args[0], |
179 | &emsg); | 173 | &emsg); |
180 | if (NULL == uri) | 174 | if (NULL == uri) |
@@ -204,8 +198,7 @@ run (void *cls, | |||
204 | return; | 198 | return; |
205 | } | 199 | } |
206 | cfg = c; | 200 | cfg = c; |
207 | ctx = GNUNET_FS_start (sched, | 201 | ctx = GNUNET_FS_start (cfg, |
208 | cfg, | ||
209 | "gnunet-download", | 202 | "gnunet-download", |
210 | &progress_cb, | 203 | &progress_cb, |
211 | NULL, | 204 | NULL, |
@@ -246,8 +239,7 @@ run (void *cls, | |||
246 | ctx = NULL; | 239 | ctx = NULL; |
247 | return; | 240 | return; |
248 | } | 241 | } |
249 | GNUNET_SCHEDULER_add_delayed (sched, | 242 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, |
250 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
251 | &shutdown_task, | 243 | &shutdown_task, |
252 | NULL); | 244 | NULL); |
253 | } | 245 | } |
diff --git a/src/fs/gnunet-pseudonym.c b/src/fs/gnunet-pseudonym.c index ba9213b5d..b7aba8ef4 100644 --- a/src/fs/gnunet-pseudonym.c +++ b/src/fs/gnunet-pseudonym.c | |||
@@ -221,14 +221,12 @@ post_advertising (void *cls, | |||
221 | * Main function that will be run by the scheduler. | 221 | * Main function that will be run by the scheduler. |
222 | * | 222 | * |
223 | * @param cls closure | 223 | * @param cls closure |
224 | * @param sched the scheduler to use | ||
225 | * @param args remaining command-line arguments | 224 | * @param args remaining command-line arguments |
226 | * @param cfgfile name of the configuration file used (for saving, can be NULL!) | 225 | * @param cfgfile name of the configuration file used (for saving, can be NULL!) |
227 | * @param c configuration | 226 | * @param c configuration |
228 | */ | 227 | */ |
229 | static void | 228 | static void |
230 | run (void *cls, | 229 | run (void *cls, |
231 | struct GNUNET_SCHEDULER_Handle *sched, | ||
232 | char *const *args, | 230 | char *const *args, |
233 | const char *cfgfile, | 231 | const char *cfgfile, |
234 | const struct GNUNET_CONFIGURATION_Handle *c) | 232 | const struct GNUNET_CONFIGURATION_Handle *c) |
@@ -237,8 +235,7 @@ run (void *cls, | |||
237 | char *emsg; | 235 | char *emsg; |
238 | 236 | ||
239 | cfg = c; | 237 | cfg = c; |
240 | h = GNUNET_FS_start (sched, | 238 | h = GNUNET_FS_start (cfg, |
241 | cfg, | ||
242 | "gnunet-pseudonym", | 239 | "gnunet-pseudonym", |
243 | &progress_cb, | 240 | &progress_cb, |
244 | NULL, | 241 | NULL, |
diff --git a/src/fs/gnunet-publish.c b/src/fs/gnunet-publish.c index 79beacc84..36e75a4ea 100644 --- a/src/fs/gnunet-publish.c +++ b/src/fs/gnunet-publish.c | |||
@@ -38,8 +38,6 @@ static const struct GNUNET_CONFIGURATION_Handle *cfg; | |||
38 | 38 | ||
39 | static struct GNUNET_FS_Handle *ctx; | 39 | static struct GNUNET_FS_Handle *ctx; |
40 | 40 | ||
41 | static struct GNUNET_SCHEDULER_Handle *sched; | ||
42 | |||
43 | static struct GNUNET_FS_PublishContext *pc; | 41 | static struct GNUNET_FS_PublishContext *pc; |
44 | 42 | ||
45 | static struct GNUNET_CONTAINER_MetaData *meta; | 43 | static struct GNUNET_CONTAINER_MetaData *meta; |
@@ -135,12 +133,10 @@ progress_cb (void *cls, | |||
135 | info->value.publish.specifics.error.message); | 133 | info->value.publish.specifics.error.message); |
136 | if (kill_task != GNUNET_SCHEDULER_NO_TASK) | 134 | if (kill_task != GNUNET_SCHEDULER_NO_TASK) |
137 | { | 135 | { |
138 | GNUNET_SCHEDULER_cancel (sched, | 136 | GNUNET_SCHEDULER_cancel (kill_task); |
139 | kill_task); | ||
140 | kill_task = GNUNET_SCHEDULER_NO_TASK; | 137 | kill_task = GNUNET_SCHEDULER_NO_TASK; |
141 | } | 138 | } |
142 | GNUNET_SCHEDULER_add_continuation (sched, | 139 | GNUNET_SCHEDULER_add_continuation (&do_stop_task, |
143 | &do_stop_task, | ||
144 | NULL, | 140 | NULL, |
145 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 141 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
146 | break; | 142 | break; |
@@ -157,12 +153,10 @@ progress_cb (void *cls, | |||
157 | { | 153 | { |
158 | if (kill_task != GNUNET_SCHEDULER_NO_TASK) | 154 | if (kill_task != GNUNET_SCHEDULER_NO_TASK) |
159 | { | 155 | { |
160 | GNUNET_SCHEDULER_cancel (sched, | 156 | GNUNET_SCHEDULER_cancel (kill_task); |
161 | kill_task); | ||
162 | kill_task = GNUNET_SCHEDULER_NO_TASK; | 157 | kill_task = GNUNET_SCHEDULER_NO_TASK; |
163 | } | 158 | } |
164 | GNUNET_SCHEDULER_add_continuation (sched, | 159 | GNUNET_SCHEDULER_add_continuation (&do_stop_task, |
165 | &do_stop_task, | ||
166 | NULL, | 160 | NULL, |
167 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 161 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
168 | } | 162 | } |
@@ -374,14 +368,12 @@ uri_ksk_continuation (void *cls, | |||
374 | * Main function that will be run by the scheduler. | 368 | * Main function that will be run by the scheduler. |
375 | * | 369 | * |
376 | * @param cls closure | 370 | * @param cls closure |
377 | * @param s the scheduler to use | ||
378 | * @param args remaining command-line arguments | 371 | * @param args remaining command-line arguments |
379 | * @param cfgfile name of the configuration file used (for saving, can be NULL!) | 372 | * @param cfgfile name of the configuration file used (for saving, can be NULL!) |
380 | * @param c configuration | 373 | * @param c configuration |
381 | */ | 374 | */ |
382 | static void | 375 | static void |
383 | run (void *cls, | 376 | run (void *cls, |
384 | struct GNUNET_SCHEDULER_Handle *s, | ||
385 | char *const *args, | 377 | char *const *args, |
386 | const char *cfgfile, | 378 | const char *cfgfile, |
387 | const struct GNUNET_CONFIGURATION_Handle *c) | 379 | const struct GNUNET_CONFIGURATION_Handle *c) |
@@ -393,7 +385,6 @@ run (void *cls, | |||
393 | char *ex; | 385 | char *ex; |
394 | char *emsg; | 386 | char *emsg; |
395 | 387 | ||
396 | sched = s; | ||
397 | /* check arguments */ | 388 | /* check arguments */ |
398 | if ((uri_string != NULL) && (extract_only)) | 389 | if ((uri_string != NULL) && (extract_only)) |
399 | { | 390 | { |
@@ -446,8 +437,7 @@ run (void *cls, | |||
446 | } | 437 | } |
447 | } | 438 | } |
448 | cfg = c; | 439 | cfg = c; |
449 | ctx = GNUNET_FS_start (sched, | 440 | ctx = GNUNET_FS_start (cfg, |
450 | cfg, | ||
451 | "gnunet-publish", | 441 | "gnunet-publish", |
452 | &progress_cb, | 442 | &progress_cb, |
453 | NULL, | 443 | NULL, |
@@ -600,8 +590,7 @@ run (void *cls, | |||
600 | ret = 1; | 590 | ret = 1; |
601 | return; | 591 | return; |
602 | } | 592 | } |
603 | kill_task = GNUNET_SCHEDULER_add_delayed (sched, | 593 | kill_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, |
604 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
605 | &do_stop_task, | 594 | &do_stop_task, |
606 | NULL); | 595 | NULL); |
607 | } | 596 | } |
diff --git a/src/fs/gnunet-search.c b/src/fs/gnunet-search.c index ab3f6b0c7..dddfe6b75 100644 --- a/src/fs/gnunet-search.c +++ b/src/fs/gnunet-search.c | |||
@@ -32,8 +32,6 @@ static int ret; | |||
32 | 32 | ||
33 | static const struct GNUNET_CONFIGURATION_Handle *cfg; | 33 | static const struct GNUNET_CONFIGURATION_Handle *cfg; |
34 | 34 | ||
35 | static struct GNUNET_SCHEDULER_Handle *sched; | ||
36 | |||
37 | static struct GNUNET_FS_Handle *ctx; | 35 | static struct GNUNET_FS_Handle *ctx; |
38 | 36 | ||
39 | static struct GNUNET_FS_SearchContext *sc; | 37 | static struct GNUNET_FS_SearchContext *sc; |
@@ -185,11 +183,10 @@ progress_cb (void *cls, | |||
185 | fprintf (stderr, | 183 | fprintf (stderr, |
186 | _("Error searching: %s.\n"), | 184 | _("Error searching: %s.\n"), |
187 | info->value.search.specifics.error.message); | 185 | info->value.search.specifics.error.message); |
188 | GNUNET_SCHEDULER_shutdown (sched); | 186 | GNUNET_SCHEDULER_shutdown (); |
189 | break; | 187 | break; |
190 | case GNUNET_FS_STATUS_SEARCH_STOPPED: | 188 | case GNUNET_FS_STATUS_SEARCH_STOPPED: |
191 | GNUNET_SCHEDULER_add_continuation (sched, | 189 | GNUNET_SCHEDULER_add_continuation (&clean_task, |
192 | &clean_task, | ||
193 | NULL, | 190 | NULL, |
194 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 191 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
195 | break; | 192 | break; |
@@ -219,14 +216,12 @@ shutdown_task (void *cls, | |||
219 | * Main function that will be run by the scheduler. | 216 | * Main function that will be run by the scheduler. |
220 | * | 217 | * |
221 | * @param cls closure | 218 | * @param cls closure |
222 | * @param s the scheduler to use | ||
223 | * @param args remaining command-line arguments | 219 | * @param args remaining command-line arguments |
224 | * @param cfgfile name of the configuration file used (for saving, can be NULL!) | 220 | * @param cfgfile name of the configuration file used (for saving, can be NULL!) |
225 | * @param c configuration | 221 | * @param c configuration |
226 | */ | 222 | */ |
227 | static void | 223 | static void |
228 | run (void *cls, | 224 | run (void *cls, |
229 | struct GNUNET_SCHEDULER_Handle *s, | ||
230 | char *const *args, | 225 | char *const *args, |
231 | const char *cfgfile, | 226 | const char *cfgfile, |
232 | const struct GNUNET_CONFIGURATION_Handle *c) | 227 | const struct GNUNET_CONFIGURATION_Handle *c) |
@@ -235,7 +230,6 @@ run (void *cls, | |||
235 | unsigned int argc; | 230 | unsigned int argc; |
236 | enum GNUNET_FS_SearchOptions options; | 231 | enum GNUNET_FS_SearchOptions options; |
237 | 232 | ||
238 | sched = s; | ||
239 | argc = 0; | 233 | argc = 0; |
240 | while (NULL != args[argc]) | 234 | while (NULL != args[argc]) |
241 | argc++; | 235 | argc++; |
@@ -250,8 +244,7 @@ run (void *cls, | |||
250 | return; | 244 | return; |
251 | } | 245 | } |
252 | cfg = c; | 246 | cfg = c; |
253 | ctx = GNUNET_FS_start (sched, | 247 | ctx = GNUNET_FS_start (cfg, |
254 | cfg, | ||
255 | "gnunet-search", | 248 | "gnunet-search", |
256 | &progress_cb, | 249 | &progress_cb, |
257 | NULL, | 250 | NULL, |
@@ -285,8 +278,7 @@ run (void *cls, | |||
285 | ret = 1; | 278 | ret = 1; |
286 | return; | 279 | return; |
287 | } | 280 | } |
288 | GNUNET_SCHEDULER_add_delayed (sched, | 281 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, |
289 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
290 | &shutdown_task, | 282 | &shutdown_task, |
291 | NULL); | 283 | NULL); |
292 | } | 284 | } |
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index 2defec397..0a537576a 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c | |||
@@ -771,11 +771,6 @@ static struct GNUNET_BLOCK_Context *block_ctx; | |||
771 | static struct GNUNET_CONFIGURATION_Handle *block_cfg; | 771 | static struct GNUNET_CONFIGURATION_Handle *block_cfg; |
772 | 772 | ||
773 | /** | 773 | /** |
774 | * Our scheduler. | ||
775 | */ | ||
776 | static struct GNUNET_SCHEDULER_Handle *sched; | ||
777 | |||
778 | /** | ||
779 | * Our configuration. | 774 | * Our configuration. |
780 | */ | 775 | */ |
781 | static const struct GNUNET_CONFIGURATION_Handle *cfg; | 776 | static const struct GNUNET_CONFIGURATION_Handle *cfg; |
@@ -1106,7 +1101,7 @@ consider_migration (void *cls, | |||
1106 | #endif | 1101 | #endif |
1107 | if (cp->delayed_transmission_request_task != GNUNET_SCHEDULER_NO_TASK) | 1102 | if (cp->delayed_transmission_request_task != GNUNET_SCHEDULER_NO_TASK) |
1108 | { | 1103 | { |
1109 | GNUNET_SCHEDULER_cancel (sched, cp->delayed_transmission_request_task); | 1104 | GNUNET_SCHEDULER_cancel (cp->delayed_transmission_request_task); |
1110 | cp->delayed_transmission_request_task = GNUNET_SCHEDULER_NO_TASK; | 1105 | cp->delayed_transmission_request_task = GNUNET_SCHEDULER_NO_TASK; |
1111 | } | 1106 | } |
1112 | cp->cth | 1107 | cp->cth |
@@ -1166,8 +1161,7 @@ consider_migration_gathering () | |||
1166 | MAX_MIGRATION_QUEUE); | 1161 | MAX_MIGRATION_QUEUE); |
1167 | delay = GNUNET_TIME_relative_max (delay, | 1162 | delay = GNUNET_TIME_relative_max (delay, |
1168 | min_migration_delay); | 1163 | min_migration_delay); |
1169 | mig_task = GNUNET_SCHEDULER_add_delayed (sched, | 1164 | mig_task = GNUNET_SCHEDULER_add_delayed (delay, |
1170 | delay, | ||
1171 | &gather_migration_blocks, | 1165 | &gather_migration_blocks, |
1172 | NULL); | 1166 | NULL); |
1173 | } | 1167 | } |
@@ -1201,8 +1195,7 @@ consider_dht_put_gathering (void *cls) | |||
1201 | (hopefully) appear */ | 1195 | (hopefully) appear */ |
1202 | delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5); | 1196 | delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5); |
1203 | } | 1197 | } |
1204 | dht_task = GNUNET_SCHEDULER_add_delayed (sched, | 1198 | dht_task = GNUNET_SCHEDULER_add_delayed (delay, |
1205 | delay, | ||
1206 | &gather_dht_put_blocks, | 1199 | &gather_dht_put_blocks, |
1207 | cls); | 1200 | cls); |
1208 | } | 1201 | } |
@@ -1542,8 +1535,7 @@ destroy_pending_request (struct PendingRequest *pr) | |||
1542 | } | 1535 | } |
1543 | if (pr->task != GNUNET_SCHEDULER_NO_TASK) | 1536 | if (pr->task != GNUNET_SCHEDULER_NO_TASK) |
1544 | { | 1537 | { |
1545 | GNUNET_SCHEDULER_cancel (sched, | 1538 | GNUNET_SCHEDULER_cancel (pr->task); |
1546 | pr->task); | ||
1547 | pr->task = GNUNET_SCHEDULER_NO_TASK; | 1539 | pr->task = GNUNET_SCHEDULER_NO_TASK; |
1548 | } | 1540 | } |
1549 | while (NULL != pr->pending_head) | 1541 | while (NULL != pr->pending_head) |
@@ -1743,8 +1735,7 @@ cron_flush_trust (void *cls, | |||
1743 | return; | 1735 | return; |
1744 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) | 1736 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) |
1745 | return; | 1737 | return; |
1746 | GNUNET_SCHEDULER_add_delayed (tc->sched, | 1738 | GNUNET_SCHEDULER_add_delayed (TRUST_FLUSH_FREQ, &cron_flush_trust, NULL); |
1747 | TRUST_FLUSH_FREQ, &cron_flush_trust, NULL); | ||
1748 | } | 1739 | } |
1749 | 1740 | ||
1750 | 1741 | ||
@@ -1843,7 +1834,7 @@ peer_disconnect_handler (void *cls, | |||
1843 | } | 1834 | } |
1844 | if (cp->delayed_transmission_request_task != GNUNET_SCHEDULER_NO_TASK) | 1835 | if (cp->delayed_transmission_request_task != GNUNET_SCHEDULER_NO_TASK) |
1845 | { | 1836 | { |
1846 | GNUNET_SCHEDULER_cancel (sched, cp->delayed_transmission_request_task); | 1837 | GNUNET_SCHEDULER_cancel (cp->delayed_transmission_request_task); |
1847 | cp->delayed_transmission_request_task = GNUNET_SCHEDULER_NO_TASK; | 1838 | cp->delayed_transmission_request_task = GNUNET_SCHEDULER_NO_TASK; |
1848 | } | 1839 | } |
1849 | while (NULL != (pm = cp->pending_messages_head)) | 1840 | while (NULL != (pm = cp->pending_messages_head)) |
@@ -1984,12 +1975,12 @@ shutdown_task (void *cls, | |||
1984 | } | 1975 | } |
1985 | if (GNUNET_SCHEDULER_NO_TASK != mig_task) | 1976 | if (GNUNET_SCHEDULER_NO_TASK != mig_task) |
1986 | { | 1977 | { |
1987 | GNUNET_SCHEDULER_cancel (sched, mig_task); | 1978 | GNUNET_SCHEDULER_cancel (mig_task); |
1988 | mig_task = GNUNET_SCHEDULER_NO_TASK; | 1979 | mig_task = GNUNET_SCHEDULER_NO_TASK; |
1989 | } | 1980 | } |
1990 | if (GNUNET_SCHEDULER_NO_TASK != dht_task) | 1981 | if (GNUNET_SCHEDULER_NO_TASK != dht_task) |
1991 | { | 1982 | { |
1992 | GNUNET_SCHEDULER_cancel (sched, dht_task); | 1983 | GNUNET_SCHEDULER_cancel (dht_task); |
1993 | dht_task = GNUNET_SCHEDULER_NO_TASK; | 1984 | dht_task = GNUNET_SCHEDULER_NO_TASK; |
1994 | } | 1985 | } |
1995 | while (client_list != NULL) | 1986 | while (client_list != NULL) |
@@ -2039,7 +2030,6 @@ shutdown_task (void *cls, | |||
2039 | block_ctx = NULL; | 2030 | block_ctx = NULL; |
2040 | GNUNET_CONFIGURATION_destroy (block_cfg); | 2031 | GNUNET_CONFIGURATION_destroy (block_cfg); |
2041 | block_cfg = NULL; | 2032 | block_cfg = NULL; |
2042 | sched = NULL; | ||
2043 | cfg = NULL; | 2033 | cfg = NULL; |
2044 | GNUNET_free_non_null (trustDirectory); | 2034 | GNUNET_free_non_null (trustDirectory); |
2045 | trustDirectory = NULL; | 2035 | trustDirectory = NULL; |
@@ -2157,8 +2147,7 @@ transmit_to_peer (void *cls, | |||
2157 | { | 2147 | { |
2158 | GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == cp->delayed_transmission_request_task); | 2148 | GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == cp->delayed_transmission_request_task); |
2159 | cp->delayed_transmission_request_task | 2149 | cp->delayed_transmission_request_task |
2160 | = GNUNET_SCHEDULER_add_delayed (sched, | 2150 | = GNUNET_SCHEDULER_add_delayed (min_delay, |
2161 | min_delay, | ||
2162 | &delayed_transmission_request, | 2151 | &delayed_transmission_request, |
2163 | cp); | 2152 | cp); |
2164 | } | 2153 | } |
@@ -2284,7 +2273,7 @@ add_to_pending_messages_for_peer (struct ConnectedPeer *cp, | |||
2284 | } | 2273 | } |
2285 | if (cp->delayed_transmission_request_task != GNUNET_SCHEDULER_NO_TASK) | 2274 | if (cp->delayed_transmission_request_task != GNUNET_SCHEDULER_NO_TASK) |
2286 | { | 2275 | { |
2287 | GNUNET_SCHEDULER_cancel (sched, cp->delayed_transmission_request_task); | 2276 | GNUNET_SCHEDULER_cancel (cp->delayed_transmission_request_task); |
2288 | cp->delayed_transmission_request_task = GNUNET_SCHEDULER_NO_TASK; | 2277 | cp->delayed_transmission_request_task = GNUNET_SCHEDULER_NO_TASK; |
2289 | } | 2278 | } |
2290 | /* need to schedule transmission */ | 2279 | /* need to schedule transmission */ |
@@ -2428,8 +2417,7 @@ transmit_query_continuation (void *cls, | |||
2428 | "Transmission of request failed, will try again later.\n"); | 2417 | "Transmission of request failed, will try again later.\n"); |
2429 | #endif | 2418 | #endif |
2430 | if (pr->task == GNUNET_SCHEDULER_NO_TASK) | 2419 | if (pr->task == GNUNET_SCHEDULER_NO_TASK) |
2431 | pr->task = GNUNET_SCHEDULER_add_delayed (sched, | 2420 | pr->task = GNUNET_SCHEDULER_add_delayed (get_processing_delay (), |
2432 | get_processing_delay (), | ||
2433 | &forward_request_task, | 2421 | &forward_request_task, |
2434 | pr); | 2422 | pr); |
2435 | return; | 2423 | return; |
@@ -2461,8 +2449,7 @@ transmit_query_continuation (void *cls, | |||
2461 | pr->used_targets[i].last_request_time = GNUNET_TIME_absolute_get (); | 2449 | pr->used_targets[i].last_request_time = GNUNET_TIME_absolute_get (); |
2462 | pr->used_targets[i].num_requests++; | 2450 | pr->used_targets[i].num_requests++; |
2463 | if (pr->task == GNUNET_SCHEDULER_NO_TASK) | 2451 | if (pr->task == GNUNET_SCHEDULER_NO_TASK) |
2464 | pr->task = GNUNET_SCHEDULER_add_delayed (sched, | 2452 | pr->task = GNUNET_SCHEDULER_add_delayed (get_processing_delay (), |
2465 | get_processing_delay (), | ||
2466 | &forward_request_task, | 2453 | &forward_request_task, |
2467 | pr); | 2454 | pr); |
2468 | } | 2455 | } |
@@ -2572,8 +2559,7 @@ target_reservation_cb (void *cls, | |||
2572 | { | 2559 | { |
2573 | /* error in communication with core, try again later */ | 2560 | /* error in communication with core, try again later */ |
2574 | if (pr->task == GNUNET_SCHEDULER_NO_TASK) | 2561 | if (pr->task == GNUNET_SCHEDULER_NO_TASK) |
2575 | pr->task = GNUNET_SCHEDULER_add_delayed (sched, | 2562 | pr->task = GNUNET_SCHEDULER_add_delayed (get_processing_delay (), |
2576 | get_processing_delay (), | ||
2577 | &forward_request_task, | 2563 | &forward_request_task, |
2578 | pr); | 2564 | pr); |
2579 | return; | 2565 | return; |
@@ -2589,8 +2575,7 @@ target_reservation_cb (void *cls, | |||
2589 | "Selected peer disconnected!\n"); | 2575 | "Selected peer disconnected!\n"); |
2590 | #endif | 2576 | #endif |
2591 | if (pr->task == GNUNET_SCHEDULER_NO_TASK) | 2577 | if (pr->task == GNUNET_SCHEDULER_NO_TASK) |
2592 | pr->task = GNUNET_SCHEDULER_add_delayed (sched, | 2578 | pr->task = GNUNET_SCHEDULER_add_delayed (get_processing_delay (), |
2593 | get_processing_delay (), | ||
2594 | &forward_request_task, | 2579 | &forward_request_task, |
2595 | pr); | 2580 | pr); |
2596 | return; | 2581 | return; |
@@ -2611,8 +2596,7 @@ target_reservation_cb (void *cls, | |||
2611 | 1, | 2596 | 1, |
2612 | GNUNET_NO); | 2597 | GNUNET_NO); |
2613 | if (pr->task == GNUNET_SCHEDULER_NO_TASK) | 2598 | if (pr->task == GNUNET_SCHEDULER_NO_TASK) |
2614 | pr->task = GNUNET_SCHEDULER_add_delayed (sched, | 2599 | pr->task = GNUNET_SCHEDULER_add_delayed (get_processing_delay (), |
2615 | get_processing_delay (), | ||
2616 | &forward_request_task, | 2600 | &forward_request_task, |
2617 | pr); | 2601 | pr); |
2618 | return; /* this target round failed */ | 2602 | return; /* this target round failed */ |
@@ -2963,8 +2947,7 @@ forward_request_task (void *cls, | |||
2963 | GNUNET_h2s (&pr->query), | 2947 | GNUNET_h2s (&pr->query), |
2964 | delay.rel_value); | 2948 | delay.rel_value); |
2965 | #endif | 2949 | #endif |
2966 | pr->task = GNUNET_SCHEDULER_add_delayed (sched, | 2950 | pr->task = GNUNET_SCHEDULER_add_delayed (delay, |
2967 | delay, | ||
2968 | &forward_request_task, | 2951 | &forward_request_task, |
2969 | pr); | 2952 | pr); |
2970 | return; /* nobody selected */ | 2953 | return; /* nobody selected */ |
@@ -2999,7 +2982,7 @@ forward_request_task (void *cls, | |||
2999 | cp = GNUNET_CONTAINER_multihashmap_get (connected_peers, | 2982 | cp = GNUNET_CONTAINER_multihashmap_get (connected_peers, |
3000 | &psc.target.hashPubKey); | 2983 | &psc.target.hashPubKey); |
3001 | GNUNET_assert (NULL != cp); | 2984 | GNUNET_assert (NULL != cp); |
3002 | pr->irc = GNUNET_CORE_peer_change_preference (sched, cfg, | 2985 | pr->irc = GNUNET_CORE_peer_change_preference (cfg, |
3003 | &psc.target, | 2986 | &psc.target, |
3004 | GNUNET_CONSTANTS_SERVICE_TIMEOUT, | 2987 | GNUNET_CONSTANTS_SERVICE_TIMEOUT, |
3005 | GNUNET_BANDWIDTH_value_init (UINT32_MAX), | 2988 | GNUNET_BANDWIDTH_value_init (UINT32_MAX), |
@@ -3263,8 +3246,7 @@ struct GNUNET_TIME_Relative art_delay; | |||
3263 | pr->do_remove = GNUNET_YES; | 3246 | pr->do_remove = GNUNET_YES; |
3264 | if (pr->task != GNUNET_SCHEDULER_NO_TASK) | 3247 | if (pr->task != GNUNET_SCHEDULER_NO_TASK) |
3265 | { | 3248 | { |
3266 | GNUNET_SCHEDULER_cancel (sched, | 3249 | GNUNET_SCHEDULER_cancel (pr->task); |
3267 | pr->task); | ||
3268 | pr->task = GNUNET_SCHEDULER_NO_TASK; | 3250 | pr->task = GNUNET_SCHEDULER_NO_TASK; |
3269 | } | 3251 | } |
3270 | GNUNET_break (GNUNET_YES == | 3252 | GNUNET_break (GNUNET_YES == |
@@ -3779,8 +3761,7 @@ process_local_reply (void *cls, | |||
3779 | } | 3761 | } |
3780 | /* no more results */ | 3762 | /* no more results */ |
3781 | if (pr->task == GNUNET_SCHEDULER_NO_TASK) | 3763 | if (pr->task == GNUNET_SCHEDULER_NO_TASK) |
3782 | pr->task = GNUNET_SCHEDULER_add_now (sched, | 3764 | pr->task = GNUNET_SCHEDULER_add_now (&forward_request_task, |
3783 | &forward_request_task, | ||
3784 | pr); | 3765 | pr); |
3785 | return; | 3766 | return; |
3786 | } | 3767 | } |
@@ -4267,8 +4248,7 @@ handle_p2p_get (void *cls, | |||
4267 | } | 4248 | } |
4268 | default: | 4249 | default: |
4269 | if (pr->task == GNUNET_SCHEDULER_NO_TASK) | 4250 | if (pr->task == GNUNET_SCHEDULER_NO_TASK) |
4270 | pr->task = GNUNET_SCHEDULER_add_now (sched, | 4251 | pr->task = GNUNET_SCHEDULER_add_now (&forward_request_task, |
4271 | &forward_request_task, | ||
4272 | pr); | 4252 | pr); |
4273 | } | 4253 | } |
4274 | 4254 | ||
@@ -4448,13 +4428,11 @@ handle_start_search (void *cls, | |||
4448 | /** | 4428 | /** |
4449 | * Process fs requests. | 4429 | * Process fs requests. |
4450 | * | 4430 | * |
4451 | * @param s scheduler to use | ||
4452 | * @param server the initialized server | 4431 | * @param server the initialized server |
4453 | * @param c configuration to use | 4432 | * @param c configuration to use |
4454 | */ | 4433 | */ |
4455 | static int | 4434 | static int |
4456 | main_init (struct GNUNET_SCHEDULER_Handle *s, | 4435 | main_init (struct GNUNET_SERVER_Handle *server, |
4457 | struct GNUNET_SERVER_Handle *server, | ||
4458 | const struct GNUNET_CONFIGURATION_Handle *c) | 4436 | const struct GNUNET_CONFIGURATION_Handle *c) |
4459 | { | 4437 | { |
4460 | static const struct GNUNET_CORE_MessageHandler p2p_handlers[] = | 4438 | static const struct GNUNET_CORE_MessageHandler p2p_handlers[] = |
@@ -4481,9 +4459,8 @@ main_init (struct GNUNET_SCHEDULER_Handle *s, | |||
4481 | }; | 4459 | }; |
4482 | unsigned long long enc = 128; | 4460 | unsigned long long enc = 128; |
4483 | 4461 | ||
4484 | sched = s; | ||
4485 | cfg = c; | 4462 | cfg = c; |
4486 | stats = GNUNET_STATISTICS_create (sched, "fs", cfg); | 4463 | stats = GNUNET_STATISTICS_create ("fs", cfg); |
4487 | min_migration_delay = GNUNET_TIME_UNIT_SECONDS; | 4464 | min_migration_delay = GNUNET_TIME_UNIT_SECONDS; |
4488 | if ( (GNUNET_OK != | 4465 | if ( (GNUNET_OK != |
4489 | GNUNET_CONFIGURATION_get_value_number (cfg, | 4466 | GNUNET_CONFIGURATION_get_value_number (cfg, |
@@ -4509,8 +4486,7 @@ main_init (struct GNUNET_SCHEDULER_Handle *s, | |||
4509 | rt_entry_lifetime = GNUNET_LOAD_value_init (GNUNET_TIME_UNIT_FOREVER_REL); | 4486 | rt_entry_lifetime = GNUNET_LOAD_value_init (GNUNET_TIME_UNIT_FOREVER_REL); |
4510 | peer_request_map = GNUNET_CONTAINER_multihashmap_create (enc); | 4487 | peer_request_map = GNUNET_CONTAINER_multihashmap_create (enc); |
4511 | requests_by_expiration_heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); | 4488 | requests_by_expiration_heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); |
4512 | core = GNUNET_CORE_connect (sched, | 4489 | core = GNUNET_CORE_connect (cfg, |
4513 | cfg, | ||
4514 | GNUNET_TIME_UNIT_FOREVER_REL, | 4490 | GNUNET_TIME_UNIT_FOREVER_REL, |
4515 | NULL, | 4491 | NULL, |
4516 | NULL, | 4492 | NULL, |
@@ -4559,14 +4535,12 @@ main_init (struct GNUNET_SCHEDULER_Handle *s, | |||
4559 | "TRUST", | 4535 | "TRUST", |
4560 | &trustDirectory)); | 4536 | &trustDirectory)); |
4561 | GNUNET_DISK_directory_create (trustDirectory); | 4537 | GNUNET_DISK_directory_create (trustDirectory); |
4562 | GNUNET_SCHEDULER_add_with_priority (sched, | 4538 | GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_HIGH, |
4563 | GNUNET_SCHEDULER_PRIORITY_HIGH, | ||
4564 | &cron_flush_trust, NULL); | 4539 | &cron_flush_trust, NULL); |
4565 | 4540 | ||
4566 | 4541 | ||
4567 | GNUNET_SERVER_add_handlers (server, handlers); | 4542 | GNUNET_SERVER_add_handlers (server, handlers); |
4568 | GNUNET_SCHEDULER_add_delayed (sched, | 4543 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, |
4569 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
4570 | &shutdown_task, | 4544 | &shutdown_task, |
4571 | NULL); | 4545 | NULL); |
4572 | return GNUNET_OK; | 4546 | return GNUNET_OK; |
@@ -4577,24 +4551,21 @@ main_init (struct GNUNET_SCHEDULER_Handle *s, | |||
4577 | * Process fs requests. | 4551 | * Process fs requests. |
4578 | * | 4552 | * |
4579 | * @param cls closure | 4553 | * @param cls closure |
4580 | * @param sched scheduler to use | ||
4581 | * @param server the initialized server | 4554 | * @param server the initialized server |
4582 | * @param cfg configuration to use | 4555 | * @param cfg configuration to use |
4583 | */ | 4556 | */ |
4584 | static void | 4557 | static void |
4585 | run (void *cls, | 4558 | run (void *cls, |
4586 | struct GNUNET_SCHEDULER_Handle *sched, | ||
4587 | struct GNUNET_SERVER_Handle *server, | 4559 | struct GNUNET_SERVER_Handle *server, |
4588 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 4560 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
4589 | { | 4561 | { |
4590 | active_migration = GNUNET_CONFIGURATION_get_value_yesno (cfg, | 4562 | active_migration = GNUNET_CONFIGURATION_get_value_yesno (cfg, |
4591 | "FS", | 4563 | "FS", |
4592 | "ACTIVEMIGRATION"); | 4564 | "ACTIVEMIGRATION"); |
4593 | dsh = GNUNET_DATASTORE_connect (cfg, | 4565 | dsh = GNUNET_DATASTORE_connect (cfg); |
4594 | sched); | ||
4595 | if (dsh == NULL) | 4566 | if (dsh == NULL) |
4596 | { | 4567 | { |
4597 | GNUNET_SCHEDULER_shutdown (sched); | 4568 | GNUNET_SCHEDULER_shutdown (); |
4598 | return; | 4569 | return; |
4599 | } | 4570 | } |
4600 | datastore_get_load = GNUNET_LOAD_value_init (DATASTORE_LOAD_AUTODECLINE); | 4571 | datastore_get_load = GNUNET_LOAD_value_init (DATASTORE_LOAD_AUTODECLINE); |
@@ -4606,13 +4577,12 @@ run (void *cls, | |||
4606 | "fs"); | 4577 | "fs"); |
4607 | block_ctx = GNUNET_BLOCK_context_create (block_cfg); | 4578 | block_ctx = GNUNET_BLOCK_context_create (block_cfg); |
4608 | GNUNET_assert (NULL != block_ctx); | 4579 | GNUNET_assert (NULL != block_ctx); |
4609 | dht_handle = GNUNET_DHT_connect (sched, | 4580 | dht_handle = GNUNET_DHT_connect (cfg, |
4610 | cfg, | ||
4611 | FS_DHT_HT_SIZE); | 4581 | FS_DHT_HT_SIZE); |
4612 | if ( (GNUNET_OK != GNUNET_FS_indexing_init (sched, cfg, dsh)) || | 4582 | if ( (GNUNET_OK != GNUNET_FS_indexing_init (cfg, dsh)) || |
4613 | (GNUNET_OK != main_init (sched, server, cfg)) ) | 4583 | (GNUNET_OK != main_init (server, cfg)) ) |
4614 | { | 4584 | { |
4615 | GNUNET_SCHEDULER_shutdown (sched); | 4585 | GNUNET_SCHEDULER_shutdown (); |
4616 | GNUNET_DATASTORE_disconnect (dsh, GNUNET_NO); | 4586 | GNUNET_DATASTORE_disconnect (dsh, GNUNET_NO); |
4617 | dsh = NULL; | 4587 | dsh = NULL; |
4618 | GNUNET_DHT_disconnect (dht_handle); | 4588 | GNUNET_DHT_disconnect (dht_handle); |
diff --git a/src/fs/gnunet-service-fs_indexing.c b/src/fs/gnunet-service-fs_indexing.c index 99b5da102..2e95f454f 100644 --- a/src/fs/gnunet-service-fs_indexing.c +++ b/src/fs/gnunet-service-fs_indexing.c | |||
@@ -91,11 +91,6 @@ static struct IndexInfo *indexed_files; | |||
91 | static struct GNUNET_CONTAINER_MultiHashMap *ifm; | 91 | static struct GNUNET_CONTAINER_MultiHashMap *ifm; |
92 | 92 | ||
93 | /** | 93 | /** |
94 | * Our scheduler. | ||
95 | */ | ||
96 | static struct GNUNET_SCHEDULER_Handle *sched; | ||
97 | |||
98 | /** | ||
99 | * Our configuration. | 94 | * Our configuration. |
100 | */ | 95 | */ |
101 | static const struct GNUNET_CONFIGURATION_Handle *cfg; | 96 | static const struct GNUNET_CONFIGURATION_Handle *cfg; |
@@ -404,8 +399,7 @@ GNUNET_FS_handle_index_start (void *cls, | |||
404 | (unsigned int) mydev); | 399 | (unsigned int) mydev); |
405 | #endif | 400 | #endif |
406 | /* slow validation, need to hash full file (again) */ | 401 | /* slow validation, need to hash full file (again) */ |
407 | ii->fhc = GNUNET_CRYPTO_hash_file (sched, | 402 | ii->fhc = GNUNET_CRYPTO_hash_file (GNUNET_SCHEDULER_PRIORITY_IDLE, |
408 | GNUNET_SCHEDULER_PRIORITY_IDLE, | ||
409 | fn, | 403 | fn, |
410 | HASHING_BLOCKSIZE, | 404 | HASHING_BLOCKSIZE, |
411 | &hash_for_index_val, | 405 | &hash_for_index_val, |
@@ -710,7 +704,6 @@ shutdown_task (void *cls, | |||
710 | indexed_files = pos->next; | 704 | indexed_files = pos->next; |
711 | GNUNET_free (pos); | 705 | GNUNET_free (pos); |
712 | } | 706 | } |
713 | sched = NULL; | ||
714 | cfg = NULL; | 707 | cfg = NULL; |
715 | } | 708 | } |
716 | 709 | ||
@@ -718,21 +711,17 @@ shutdown_task (void *cls, | |||
718 | /** | 711 | /** |
719 | * Initialize the indexing submodule. | 712 | * Initialize the indexing submodule. |
720 | * | 713 | * |
721 | * @param s scheduler to use | ||
722 | * @param c configuration to use | 714 | * @param c configuration to use |
723 | * @param d datastore to use | 715 | * @param d datastore to use |
724 | */ | 716 | */ |
725 | int | 717 | int |
726 | GNUNET_FS_indexing_init (struct GNUNET_SCHEDULER_Handle *s, | 718 | GNUNET_FS_indexing_init (const struct GNUNET_CONFIGURATION_Handle *c, |
727 | const struct GNUNET_CONFIGURATION_Handle *c, | ||
728 | struct GNUNET_DATASTORE_Handle *d) | 719 | struct GNUNET_DATASTORE_Handle *d) |
729 | { | 720 | { |
730 | sched = s; | ||
731 | cfg = c; | 721 | cfg = c; |
732 | dsh = d; | 722 | dsh = d; |
733 | ifm = GNUNET_CONTAINER_multihashmap_create (128); | 723 | ifm = GNUNET_CONTAINER_multihashmap_create (128); |
734 | GNUNET_SCHEDULER_add_delayed (sched, | 724 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, |
735 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
736 | &shutdown_task, | 725 | &shutdown_task, |
737 | NULL); | 726 | NULL); |
738 | read_index_list (); | 727 | read_index_list (); |
diff --git a/src/fs/gnunet-service-fs_indexing.h b/src/fs/gnunet-service-fs_indexing.h index bf063fcbd..885e141e2 100644 --- a/src/fs/gnunet-service-fs_indexing.h +++ b/src/fs/gnunet-service-fs_indexing.h | |||
@@ -110,14 +110,12 @@ GNUNET_FS_handle_unindex (void *cls, | |||
110 | /** | 110 | /** |
111 | * Initialize the indexing submodule. | 111 | * Initialize the indexing submodule. |
112 | * | 112 | * |
113 | * @param s scheduler to use | ||
114 | * @param c configuration to use | 113 | * @param c configuration to use |
115 | * @param d datastore to use | 114 | * @param d datastore to use |
116 | * @return GNUNET_OK on success | 115 | * @return GNUNET_OK on success |
117 | */ | 116 | */ |
118 | int | 117 | int |
119 | GNUNET_FS_indexing_init (struct GNUNET_SCHEDULER_Handle *s, | 118 | GNUNET_FS_indexing_init (const struct GNUNET_CONFIGURATION_Handle *c, |
120 | const struct GNUNET_CONFIGURATION_Handle *c, | ||
121 | struct GNUNET_DATASTORE_Handle *d); | 119 | struct GNUNET_DATASTORE_Handle *d); |
122 | 120 | ||
123 | 121 | ||
diff --git a/src/fs/gnunet-unindex.c b/src/fs/gnunet-unindex.c index 872aa3d3a..f73d2f0cc 100644 --- a/src/fs/gnunet-unindex.c +++ b/src/fs/gnunet-unindex.c | |||
@@ -38,8 +38,6 @@ static struct GNUNET_FS_Handle *ctx; | |||
38 | 38 | ||
39 | static struct GNUNET_FS_UnindexContext *uc; | 39 | static struct GNUNET_FS_UnindexContext *uc; |
40 | 40 | ||
41 | static struct GNUNET_SCHEDULER_Handle *sched; | ||
42 | |||
43 | 41 | ||
44 | static void | 42 | static void |
45 | cleanup_task (void *cls, | 43 | cleanup_task (void *cls, |
@@ -103,16 +101,15 @@ progress_cb (void *cls, | |||
103 | fprintf (stderr, | 101 | fprintf (stderr, |
104 | _("Error unindexing: %s.\n"), | 102 | _("Error unindexing: %s.\n"), |
105 | info->value.unindex.specifics.error.message); | 103 | info->value.unindex.specifics.error.message); |
106 | GNUNET_SCHEDULER_shutdown (sched); | 104 | GNUNET_SCHEDULER_shutdown (); |
107 | break; | 105 | break; |
108 | case GNUNET_FS_STATUS_UNINDEX_COMPLETED: | 106 | case GNUNET_FS_STATUS_UNINDEX_COMPLETED: |
109 | fprintf (stdout, | 107 | fprintf (stdout, |
110 | _("Unindexing done.\n")); | 108 | _("Unindexing done.\n")); |
111 | GNUNET_SCHEDULER_shutdown (sched); | 109 | GNUNET_SCHEDULER_shutdown (); |
112 | break; | 110 | break; |
113 | case GNUNET_FS_STATUS_UNINDEX_STOPPED: | 111 | case GNUNET_FS_STATUS_UNINDEX_STOPPED: |
114 | GNUNET_SCHEDULER_add_continuation (sched, | 112 | GNUNET_SCHEDULER_add_continuation (&cleanup_task, |
115 | &cleanup_task, | ||
116 | NULL, | 113 | NULL, |
117 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 114 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
118 | break; | 115 | break; |
@@ -130,14 +127,12 @@ progress_cb (void *cls, | |||
130 | * Main function that will be run by the scheduler. | 127 | * Main function that will be run by the scheduler. |
131 | * | 128 | * |
132 | * @param cls closure | 129 | * @param cls closure |
133 | * @param s the scheduler to use | ||
134 | * @param args remaining command-line arguments | 130 | * @param args remaining command-line arguments |
135 | * @param cfgfile name of the configuration file used (for saving, can be NULL!) | 131 | * @param cfgfile name of the configuration file used (for saving, can be NULL!) |
136 | * @param c configuration | 132 | * @param c configuration |
137 | */ | 133 | */ |
138 | static void | 134 | static void |
139 | run (void *cls, | 135 | run (void *cls, |
140 | struct GNUNET_SCHEDULER_Handle *s, | ||
141 | char *const *args, | 136 | char *const *args, |
142 | const char *cfgfile, | 137 | const char *cfgfile, |
143 | const struct GNUNET_CONFIGURATION_Handle *c) | 138 | const struct GNUNET_CONFIGURATION_Handle *c) |
@@ -150,10 +145,8 @@ run (void *cls, | |||
150 | ret = -1; | 145 | ret = -1; |
151 | return; | 146 | return; |
152 | } | 147 | } |
153 | sched = s; | ||
154 | cfg = c; | 148 | cfg = c; |
155 | ctx = GNUNET_FS_start (sched, | 149 | ctx = GNUNET_FS_start (cfg, |
156 | cfg, | ||
157 | "gnunet-unindex", | 150 | "gnunet-unindex", |
158 | &progress_cb, | 151 | &progress_cb, |
159 | NULL, | 152 | NULL, |
@@ -177,8 +170,7 @@ run (void *cls, | |||
177 | GNUNET_FS_stop (ctx); | 170 | GNUNET_FS_stop (ctx); |
178 | return; | 171 | return; |
179 | } | 172 | } |
180 | GNUNET_SCHEDULER_add_delayed (sched, | 173 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, |
181 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
182 | &shutdown_task, | 174 | &shutdown_task, |
183 | NULL); | 175 | NULL); |
184 | } | 176 | } |
diff --git a/src/fs/perf_gnunet_service_fs_p2p.c b/src/fs/perf_gnunet_service_fs_p2p.c index 8b1c0ad24..8d5ad6587 100644 --- a/src/fs/perf_gnunet_service_fs_p2p.c +++ b/src/fs/perf_gnunet_service_fs_p2p.c | |||
@@ -45,8 +45,6 @@ | |||
45 | 45 | ||
46 | static struct GNUNET_FS_TestDaemon *daemons[NUM_DAEMONS]; | 46 | static struct GNUNET_FS_TestDaemon *daemons[NUM_DAEMONS]; |
47 | 47 | ||
48 | static struct GNUNET_SCHEDULER_Handle *sched; | ||
49 | |||
50 | static int ok; | 48 | static int ok; |
51 | 49 | ||
52 | static struct GNUNET_TIME_Absolute start_time; | 50 | static struct GNUNET_TIME_Absolute start_time; |
@@ -57,8 +55,7 @@ static void | |||
57 | do_stop (void *cls, | 55 | do_stop (void *cls, |
58 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 56 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
59 | { | 57 | { |
60 | GNUNET_FS_TEST_daemons_stop (sched, | 58 | GNUNET_FS_TEST_daemons_stop (NUM_DAEMONS, |
61 | NUM_DAEMONS, | ||
62 | daemons); | 59 | daemons); |
63 | } | 60 | } |
64 | 61 | ||
@@ -152,7 +149,7 @@ get_done (void *cls, | |||
152 | struct StatMaster *sm = cls; | 149 | struct StatMaster *sm = cls; |
153 | GNUNET_break (GNUNET_OK == success); | 150 | GNUNET_break (GNUNET_OK == success); |
154 | sm->value++; | 151 | sm->value++; |
155 | GNUNET_SCHEDULER_add_now (sched, &stat_run, sm); | 152 | GNUNET_SCHEDULER_add_now (&stat_run, sm); |
156 | } | 153 | } |
157 | 154 | ||
158 | 155 | ||
@@ -185,13 +182,13 @@ stat_run (void *cls, | |||
185 | if (sm->daemon == NUM_DAEMONS) | 182 | if (sm->daemon == NUM_DAEMONS) |
186 | { | 183 | { |
187 | GNUNET_free (sm); | 184 | GNUNET_free (sm); |
188 | GNUNET_SCHEDULER_add_now (sched, &do_stop, NULL); | 185 | GNUNET_SCHEDULER_add_now (&do_stop, NULL); |
189 | return; | 186 | return; |
190 | } | 187 | } |
191 | sm->stat = GNUNET_STATISTICS_create (sched, "<driver>", | 188 | sm->stat = GNUNET_STATISTICS_create ("<driver>", |
192 | GNUNET_FS_TEST_get_configuration (daemons, | 189 | GNUNET_FS_TEST_get_configuration (daemons, |
193 | sm->daemon)); | 190 | sm->daemon)); |
194 | GNUNET_SCHEDULER_add_now (sched, &stat_run, sm); | 191 | GNUNET_SCHEDULER_add_now (&stat_run, sm); |
195 | } | 192 | } |
196 | 193 | ||
197 | 194 | ||
@@ -217,17 +214,17 @@ do_report (void *cls, | |||
217 | "Finished download, shutting down\n", | 214 | "Finished download, shutting down\n", |
218 | (unsigned long long) FILESIZE); | 215 | (unsigned long long) FILESIZE); |
219 | sm = GNUNET_malloc (sizeof (struct StatMaster)); | 216 | sm = GNUNET_malloc (sizeof (struct StatMaster)); |
220 | sm->stat = GNUNET_STATISTICS_create (sched, "<driver>", | 217 | sm->stat = GNUNET_STATISTICS_create ("<driver>", |
221 | GNUNET_FS_TEST_get_configuration (daemons, | 218 | GNUNET_FS_TEST_get_configuration (daemons, |
222 | sm->daemon)); | 219 | sm->daemon)); |
223 | GNUNET_SCHEDULER_add_now (sched, &stat_run, sm); | 220 | GNUNET_SCHEDULER_add_now (&stat_run, sm); |
224 | } | 221 | } |
225 | else | 222 | else |
226 | { | 223 | { |
227 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 224 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
228 | "Timeout during download, shutting down with error\n"); | 225 | "Timeout during download, shutting down with error\n"); |
229 | ok = 1; | 226 | ok = 1; |
230 | GNUNET_SCHEDULER_add_now (sched, &do_stop, NULL); | 227 | GNUNET_SCHEDULER_add_now (&do_stop, NULL); |
231 | } | 228 | } |
232 | } | 229 | } |
233 | 230 | ||
@@ -240,8 +237,7 @@ do_download (void *cls, | |||
240 | 237 | ||
241 | if (NULL == uri) | 238 | if (NULL == uri) |
242 | { | 239 | { |
243 | GNUNET_FS_TEST_daemons_stop (sched, | 240 | GNUNET_FS_TEST_daemons_stop (NUM_DAEMONS, |
244 | NUM_DAEMONS, | ||
245 | daemons); | 241 | daemons); |
246 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 242 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
247 | "Timeout during upload attempt, shutting down with error\n"); | 243 | "Timeout during upload attempt, shutting down with error\n"); |
@@ -256,8 +252,7 @@ do_download (void *cls, | |||
256 | anonymity = 0; | 252 | anonymity = 0; |
257 | else | 253 | else |
258 | anonymity = 1; | 254 | anonymity = 1; |
259 | GNUNET_FS_TEST_download (sched, | 255 | GNUNET_FS_TEST_download (daemons[0], |
260 | daemons[0], | ||
261 | TIMEOUT, | 256 | TIMEOUT, |
262 | anonymity, SEED, uri, | 257 | anonymity, SEED, uri, |
263 | VERBOSE, | 258 | VERBOSE, |
@@ -274,8 +269,7 @@ do_publish (void *cls, | |||
274 | 269 | ||
275 | if (NULL != emsg) | 270 | if (NULL != emsg) |
276 | { | 271 | { |
277 | GNUNET_FS_TEST_daemons_stop (sched, | 272 | GNUNET_FS_TEST_daemons_stop (NUM_DAEMONS, |
278 | NUM_DAEMONS, | ||
279 | daemons); | 273 | daemons); |
280 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 274 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
281 | "Error trying to connect: %s\n", | 275 | "Error trying to connect: %s\n", |
@@ -295,8 +289,7 @@ do_publish (void *cls, | |||
295 | else | 289 | else |
296 | anonymity = 1; | 290 | anonymity = 1; |
297 | 291 | ||
298 | GNUNET_FS_TEST_publish (sched, | 292 | GNUNET_FS_TEST_publish (daemons[NUM_DAEMONS-1], |
299 | daemons[NUM_DAEMONS-1], | ||
300 | TIMEOUT, | 293 | TIMEOUT, |
301 | anonymity, | 294 | anonymity, |
302 | do_index, FILESIZE, SEED, | 295 | do_index, FILESIZE, SEED, |
@@ -331,14 +324,11 @@ do_connect (void *cls, | |||
331 | 324 | ||
332 | static void | 325 | static void |
333 | run (void *cls, | 326 | run (void *cls, |
334 | struct GNUNET_SCHEDULER_Handle *s, | ||
335 | char *const *args, | 327 | char *const *args, |
336 | const char *cfgfile, | 328 | const char *cfgfile, |
337 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 329 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
338 | { | 330 | { |
339 | sched = s; | 331 | GNUNET_FS_TEST_daemons_start ("fs_test_lib_data.conf", |
340 | GNUNET_FS_TEST_daemons_start (sched, | ||
341 | "fs_test_lib_data.conf", | ||
342 | TIMEOUT, | 332 | TIMEOUT, |
343 | NUM_DAEMONS, | 333 | NUM_DAEMONS, |
344 | daemons, | 334 | daemons, |
diff --git a/src/fs/test_fs_download.c b/src/fs/test_fs_download.c index 4bcedcb4d..549a2eeed 100644 --- a/src/fs/test_fs_download.c +++ b/src/fs/test_fs_download.c | |||
@@ -60,8 +60,6 @@ static struct PeerContext p1; | |||
60 | 60 | ||
61 | static struct GNUNET_TIME_Absolute start; | 61 | static struct GNUNET_TIME_Absolute start; |
62 | 62 | ||
63 | static struct GNUNET_SCHEDULER_Handle *sched; | ||
64 | |||
65 | static struct GNUNET_FS_Handle *fs; | 63 | static struct GNUNET_FS_Handle *fs; |
66 | 64 | ||
67 | static struct GNUNET_FS_DownloadContext *download; | 65 | static struct GNUNET_FS_DownloadContext *download; |
@@ -127,7 +125,7 @@ abort_download_task (void *cls, | |||
127 | GNUNET_DISK_directory_remove (fn); | 125 | GNUNET_DISK_directory_remove (fn); |
128 | GNUNET_free (fn); | 126 | GNUNET_free (fn); |
129 | fn = NULL; | 127 | fn = NULL; |
130 | GNUNET_SCHEDULER_cancel (sched, timeout_kill); | 128 | GNUNET_SCHEDULER_cancel (timeout_kill); |
131 | timeout_kill = GNUNET_SCHEDULER_NO_TASK; | 129 | timeout_kill = GNUNET_SCHEDULER_NO_TASK; |
132 | } | 130 | } |
133 | 131 | ||
@@ -168,8 +166,7 @@ progress_cb (void *cls, | |||
168 | case GNUNET_FS_STATUS_DOWNLOAD_COMPLETED: | 166 | case GNUNET_FS_STATUS_DOWNLOAD_COMPLETED: |
169 | printf ("Download complete, %llu kbps.\n", | 167 | printf ("Download complete, %llu kbps.\n", |
170 | (unsigned long long) (FILESIZE * 1000LL / (1+GNUNET_TIME_absolute_get_duration (start).rel_value) / 1024LL)); | 168 | (unsigned long long) (FILESIZE * 1000LL / (1+GNUNET_TIME_absolute_get_duration (start).rel_value) / 1024LL)); |
171 | GNUNET_SCHEDULER_add_now (sched, | 169 | GNUNET_SCHEDULER_add_now (&abort_download_task, |
172 | &abort_download_task, | ||
173 | NULL); | 170 | NULL); |
174 | break; | 171 | break; |
175 | case GNUNET_FS_STATUS_DOWNLOAD_PROGRESS: | 172 | case GNUNET_FS_STATUS_DOWNLOAD_PROGRESS: |
@@ -187,8 +184,7 @@ progress_cb (void *cls, | |||
187 | "Error publishing file: %s\n", | 184 | "Error publishing file: %s\n", |
188 | event->value.publish.specifics.error.message); | 185 | event->value.publish.specifics.error.message); |
189 | GNUNET_break (0); | 186 | GNUNET_break (0); |
190 | GNUNET_SCHEDULER_add_continuation (sched, | 187 | GNUNET_SCHEDULER_add_continuation (&abort_publish_task, |
191 | &abort_publish_task, | ||
192 | NULL, | 188 | NULL, |
193 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 189 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
194 | break; | 190 | break; |
@@ -196,8 +192,7 @@ progress_cb (void *cls, | |||
196 | fprintf (stderr, | 192 | fprintf (stderr, |
197 | "Error downloading file: %s\n", | 193 | "Error downloading file: %s\n", |
198 | event->value.download.specifics.error.message); | 194 | event->value.download.specifics.error.message); |
199 | GNUNET_SCHEDULER_add_now (sched, | 195 | GNUNET_SCHEDULER_add_now (&abort_download_task, |
200 | &abort_download_task, | ||
201 | NULL); | 196 | NULL); |
202 | break; | 197 | break; |
203 | case GNUNET_FS_STATUS_DOWNLOAD_ACTIVE: | 198 | case GNUNET_FS_STATUS_DOWNLOAD_ACTIVE: |
@@ -214,8 +209,7 @@ progress_cb (void *cls, | |||
214 | GNUNET_assert (publish == event->value.publish.pc); | 209 | GNUNET_assert (publish == event->value.publish.pc); |
215 | GNUNET_assert (FILESIZE == event->value.publish.size); | 210 | GNUNET_assert (FILESIZE == event->value.publish.size); |
216 | GNUNET_assert (1 == event->value.publish.anonymity); | 211 | GNUNET_assert (1 == event->value.publish.anonymity); |
217 | GNUNET_SCHEDULER_add_now (sched, | 212 | GNUNET_SCHEDULER_add_now (&stop_fs_task, |
218 | &stop_fs_task, | ||
219 | NULL); | 213 | NULL); |
220 | break; | 214 | break; |
221 | case GNUNET_FS_STATUS_DOWNLOAD_START: | 215 | case GNUNET_FS_STATUS_DOWNLOAD_START: |
@@ -230,8 +224,7 @@ progress_cb (void *cls, | |||
230 | break; | 224 | break; |
231 | case GNUNET_FS_STATUS_DOWNLOAD_STOPPED: | 225 | case GNUNET_FS_STATUS_DOWNLOAD_STOPPED: |
232 | GNUNET_assert (download == event->value.download.dc); | 226 | GNUNET_assert (download == event->value.download.dc); |
233 | GNUNET_SCHEDULER_add_continuation (sched, | 227 | GNUNET_SCHEDULER_add_continuation (&abort_publish_task, |
234 | &abort_publish_task, | ||
235 | NULL, | 228 | NULL, |
236 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 229 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
237 | break; | 230 | break; |
@@ -279,7 +272,6 @@ stop_arm (struct PeerContext *p) | |||
279 | 272 | ||
280 | static void | 273 | static void |
281 | run (void *cls, | 274 | run (void *cls, |
282 | struct GNUNET_SCHEDULER_Handle *s, | ||
283 | char *const *args, | 275 | char *const *args, |
284 | const char *cfgfile, | 276 | const char *cfgfile, |
285 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 277 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
@@ -294,10 +286,8 @@ run (void *cls, | |||
294 | struct GNUNET_FS_FileInformation *fi; | 286 | struct GNUNET_FS_FileInformation *fi; |
295 | size_t i; | 287 | size_t i; |
296 | 288 | ||
297 | sched = s; | ||
298 | setup_peer (&p1, "test_fs_download_data.conf"); | 289 | setup_peer (&p1, "test_fs_download_data.conf"); |
299 | fs = GNUNET_FS_start (sched, | 290 | fs = GNUNET_FS_start (cfg, |
300 | cfg, | ||
301 | "test-fs-download", | 291 | "test-fs-download", |
302 | &progress_cb, | 292 | &progress_cb, |
303 | NULL, | 293 | NULL, |
@@ -322,8 +312,7 @@ run (void *cls, | |||
322 | GNUNET_FS_uri_destroy (kuri); | 312 | GNUNET_FS_uri_destroy (kuri); |
323 | GNUNET_CONTAINER_meta_data_destroy (meta); | 313 | GNUNET_CONTAINER_meta_data_destroy (meta); |
324 | GNUNET_assert (NULL != fi); | 314 | GNUNET_assert (NULL != fi); |
325 | timeout_kill = GNUNET_SCHEDULER_add_delayed (sched, | 315 | timeout_kill = GNUNET_SCHEDULER_add_delayed (TIMEOUT, |
326 | TIMEOUT, | ||
327 | &timeout_kill_task, | 316 | &timeout_kill_task, |
328 | NULL); | 317 | NULL); |
329 | start = GNUNET_TIME_absolute_get (); | 318 | start = GNUNET_TIME_absolute_get (); |
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 | ||
61 | static struct GNUNET_TIME_Absolute start; | 61 | static struct GNUNET_TIME_Absolute start; |
62 | 62 | ||
63 | static struct GNUNET_SCHEDULER_Handle *sched; | ||
64 | |||
65 | static struct GNUNET_FS_Handle *fs; | 63 | static struct GNUNET_FS_Handle *fs; |
66 | 64 | ||
67 | static struct GNUNET_FS_DownloadContext *download; | 65 | static 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 | ||
282 | static void | 275 | static void |
283 | run (void *cls, | 276 | run (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 (); |
diff --git a/src/fs/test_fs_download_persistence.c b/src/fs/test_fs_download_persistence.c index 966d52412..66d1199ca 100644 --- a/src/fs/test_fs_download_persistence.c +++ b/src/fs/test_fs_download_persistence.c | |||
@@ -60,8 +60,6 @@ static struct PeerContext p1; | |||
60 | 60 | ||
61 | static struct GNUNET_TIME_Absolute start; | 61 | static struct GNUNET_TIME_Absolute start; |
62 | 62 | ||
63 | static struct GNUNET_SCHEDULER_Handle *sched; | ||
64 | |||
65 | static const struct GNUNET_CONFIGURATION_Handle *cfg; | 63 | static const struct GNUNET_CONFIGURATION_Handle *cfg; |
66 | 64 | ||
67 | static struct GNUNET_FS_Handle *fs; | 65 | static struct GNUNET_FS_Handle *fs; |
@@ -122,7 +120,7 @@ abort_download_task (void *cls, | |||
122 | GNUNET_DISK_directory_remove (fn); | 120 | GNUNET_DISK_directory_remove (fn); |
123 | GNUNET_free (fn); | 121 | GNUNET_free (fn); |
124 | fn = NULL; | 122 | fn = NULL; |
125 | GNUNET_SCHEDULER_cancel (sched, timeout_kill); | 123 | GNUNET_SCHEDULER_cancel (timeout_kill); |
126 | timeout_kill = GNUNET_SCHEDULER_NO_TASK; | 124 | timeout_kill = GNUNET_SCHEDULER_NO_TASK; |
127 | } | 125 | } |
128 | 126 | ||
@@ -137,8 +135,7 @@ restart_fs_task (void *cls, | |||
137 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 135 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
138 | { | 136 | { |
139 | GNUNET_FS_stop (fs); | 137 | GNUNET_FS_stop (fs); |
140 | fs = GNUNET_FS_start (sched, | 138 | fs = GNUNET_FS_start (cfg, |
141 | cfg, | ||
142 | "test-fs-download-persistence", | 139 | "test-fs-download-persistence", |
143 | &progress_cb, | 140 | &progress_cb, |
144 | NULL, | 141 | NULL, |
@@ -164,8 +161,7 @@ consider_restart (int ev) | |||
164 | if (prev[i] == ev) | 161 | if (prev[i] == ev) |
165 | return; | 162 | return; |
166 | prev[off++] = ev; | 163 | prev[off++] = ev; |
167 | GNUNET_SCHEDULER_add_with_priority (sched, | 164 | GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_URGENT, |
168 | GNUNET_SCHEDULER_PRIORITY_URGENT, | ||
169 | &restart_fs_task, | 165 | &restart_fs_task, |
170 | NULL); | 166 | NULL); |
171 | } | 167 | } |
@@ -207,8 +203,7 @@ progress_cb (void *cls, | |||
207 | consider_restart (event->status); | 203 | consider_restart (event->status); |
208 | printf ("Download complete, %llu kbps.\n", | 204 | printf ("Download complete, %llu kbps.\n", |
209 | (unsigned long long) (FILESIZE * 1000LL / (1+GNUNET_TIME_absolute_get_duration (start).rel_value) / 1024LL)); | 205 | (unsigned long long) (FILESIZE * 1000LL / (1+GNUNET_TIME_absolute_get_duration (start).rel_value) / 1024LL)); |
210 | GNUNET_SCHEDULER_add_now (sched, | 206 | GNUNET_SCHEDULER_add_now (&abort_download_task, |
211 | &abort_download_task, | ||
212 | NULL); | 207 | NULL); |
213 | break; | 208 | break; |
214 | case GNUNET_FS_STATUS_DOWNLOAD_PROGRESS: | 209 | case GNUNET_FS_STATUS_DOWNLOAD_PROGRESS: |
@@ -227,8 +222,7 @@ progress_cb (void *cls, | |||
227 | "Error publishing file: %s\n", | 222 | "Error publishing file: %s\n", |
228 | event->value.publish.specifics.error.message); | 223 | event->value.publish.specifics.error.message); |
229 | GNUNET_break (0); | 224 | GNUNET_break (0); |
230 | GNUNET_SCHEDULER_add_continuation (sched, | 225 | GNUNET_SCHEDULER_add_continuation (&abort_publish_task, |
231 | &abort_publish_task, | ||
232 | NULL, | 226 | NULL, |
233 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 227 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
234 | break; | 228 | break; |
@@ -236,8 +230,7 @@ progress_cb (void *cls, | |||
236 | fprintf (stderr, | 230 | fprintf (stderr, |
237 | "Error downloading file: %s\n", | 231 | "Error downloading file: %s\n", |
238 | event->value.download.specifics.error.message); | 232 | event->value.download.specifics.error.message); |
239 | GNUNET_SCHEDULER_add_now (sched, | 233 | GNUNET_SCHEDULER_add_now (&abort_download_task, |
240 | &abort_download_task, | ||
241 | NULL); | 234 | NULL); |
242 | break; | 235 | break; |
243 | case GNUNET_FS_STATUS_PUBLISH_SUSPEND: | 236 | case GNUNET_FS_STATUS_PUBLISH_SUSPEND: |
@@ -290,8 +283,7 @@ progress_cb (void *cls, | |||
290 | break; | 283 | break; |
291 | case GNUNET_FS_STATUS_DOWNLOAD_STOPPED: | 284 | case GNUNET_FS_STATUS_DOWNLOAD_STOPPED: |
292 | GNUNET_assert (download == event->value.download.dc); | 285 | GNUNET_assert (download == event->value.download.dc); |
293 | GNUNET_SCHEDULER_add_continuation (sched, | 286 | GNUNET_SCHEDULER_add_continuation (&abort_publish_task, |
294 | &abort_publish_task, | ||
295 | NULL, | 287 | NULL, |
296 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 288 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
297 | download = NULL; | 289 | download = NULL; |
@@ -340,7 +332,6 @@ stop_arm (struct PeerContext *p) | |||
340 | 332 | ||
341 | static void | 333 | static void |
342 | run (void *cls, | 334 | run (void *cls, |
343 | struct GNUNET_SCHEDULER_Handle *s, | ||
344 | char *const *args, | 335 | char *const *args, |
345 | const char *cfgfile, | 336 | const char *cfgfile, |
346 | const struct GNUNET_CONFIGURATION_Handle *c) | 337 | const struct GNUNET_CONFIGURATION_Handle *c) |
@@ -355,11 +346,9 @@ run (void *cls, | |||
355 | struct GNUNET_FS_FileInformation *fi; | 346 | struct GNUNET_FS_FileInformation *fi; |
356 | size_t i; | 347 | size_t i; |
357 | 348 | ||
358 | sched = s; | ||
359 | cfg = c; | 349 | cfg = c; |
360 | setup_peer (&p1, "test_fs_download_data.conf"); | 350 | setup_peer (&p1, "test_fs_download_data.conf"); |
361 | fs = GNUNET_FS_start (sched, | 351 | fs = GNUNET_FS_start (cfg, |
362 | cfg, | ||
363 | "test-fs-download-persistence", | 352 | "test-fs-download-persistence", |
364 | &progress_cb, | 353 | &progress_cb, |
365 | NULL, | 354 | NULL, |
@@ -384,8 +373,7 @@ run (void *cls, | |||
384 | GNUNET_FS_uri_destroy (kuri); | 373 | GNUNET_FS_uri_destroy (kuri); |
385 | GNUNET_CONTAINER_meta_data_destroy (meta); | 374 | GNUNET_CONTAINER_meta_data_destroy (meta); |
386 | GNUNET_assert (NULL != fi); | 375 | GNUNET_assert (NULL != fi); |
387 | timeout_kill = GNUNET_SCHEDULER_add_delayed (sched, | 376 | timeout_kill = GNUNET_SCHEDULER_add_delayed (TIMEOUT, |
388 | TIMEOUT, | ||
389 | &timeout_kill_task, | 377 | &timeout_kill_task, |
390 | NULL); | 378 | NULL); |
391 | start = GNUNET_TIME_absolute_get (); | 379 | start = GNUNET_TIME_absolute_get (); |
diff --git a/src/fs/test_fs_file_information.c b/src/fs/test_fs_file_information.c index 57698165e..914dbad9f 100644 --- a/src/fs/test_fs_file_information.c +++ b/src/fs/test_fs_file_information.c | |||
@@ -67,7 +67,6 @@ mycleaner(void *cls, | |||
67 | 67 | ||
68 | static void | 68 | static void |
69 | run (void *cls, | 69 | run (void *cls, |
70 | struct GNUNET_SCHEDULER_Handle *s, | ||
71 | char *const *args, | 70 | char *const *args, |
72 | const char *cfgfile, | 71 | const char *cfgfile, |
73 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 72 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
@@ -87,7 +86,7 @@ run (void *cls, | |||
87 | struct GNUNET_FS_Handle *fs; | 86 | struct GNUNET_FS_Handle *fs; |
88 | size_t i; | 87 | size_t i; |
89 | 88 | ||
90 | fs = GNUNET_FS_start (s, cfg, "test-fs-file-information", NULL, NULL, | 89 | fs = GNUNET_FS_start (cfg, "test-fs-file-information", NULL, NULL, |
91 | GNUNET_FS_FLAGS_NONE, | 90 | GNUNET_FS_FLAGS_NONE, |
92 | GNUNET_FS_OPTIONS_END); | 91 | GNUNET_FS_OPTIONS_END); |
93 | fn1 = GNUNET_DISK_mktemp ("gnunet-file_information-test-dst"); | 92 | fn1 = GNUNET_DISK_mktemp ("gnunet-file_information-test-dst"); |
diff --git a/src/fs/test_fs_list_indexed.c b/src/fs/test_fs_list_indexed.c index 0e46336df..206e58baf 100644 --- a/src/fs/test_fs_list_indexed.c +++ b/src/fs/test_fs_list_indexed.c | |||
@@ -64,8 +64,6 @@ static struct PeerContext p1; | |||
64 | 64 | ||
65 | static struct GNUNET_TIME_Absolute start; | 65 | static struct GNUNET_TIME_Absolute start; |
66 | 66 | ||
67 | static struct GNUNET_SCHEDULER_Handle *sched; | ||
68 | |||
69 | static struct GNUNET_FS_Handle *fs; | 67 | static struct GNUNET_FS_Handle *fs; |
70 | 68 | ||
71 | static struct GNUNET_FS_PublishContext *publish; | 69 | static struct GNUNET_FS_PublishContext *publish; |
@@ -96,8 +94,7 @@ list_indexed_task (void *cls, | |||
96 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 94 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
97 | { | 95 | { |
98 | 96 | ||
99 | GNUNET_SCHEDULER_add_continuation (sched, | 97 | GNUNET_SCHEDULER_add_continuation (&abort_publish_task, |
100 | &abort_publish_task, | ||
101 | NULL, | 98 | NULL, |
102 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 99 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
103 | } | 100 | } |
@@ -118,8 +115,7 @@ progress_cb (void *cls, | |||
118 | (unsigned long long) (FILESIZE * 1000 / (1+GNUNET_TIME_absolute_get_duration (start).rel_value) / 1024)); | 115 | (unsigned long long) (FILESIZE * 1000 / (1+GNUNET_TIME_absolute_get_duration (start).rel_value) / 1024)); |
119 | if (0 == strcmp ("list_indexed-context-dir", | 116 | if (0 == strcmp ("list_indexed-context-dir", |
120 | event->value.publish.cctx)) | 117 | event->value.publish.cctx)) |
121 | GNUNET_SCHEDULER_add_continuation (sched, | 118 | GNUNET_SCHEDULER_add_continuation (&list_indexed_task, |
122 | &list_indexed_task, | ||
123 | NULL, | 119 | NULL, |
124 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 120 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
125 | 121 | ||
@@ -143,8 +139,7 @@ progress_cb (void *cls, | |||
143 | err = 1; | 139 | err = 1; |
144 | if (0 == strcmp ("list_indexed-context-dir", | 140 | if (0 == strcmp ("list_indexed-context-dir", |
145 | event->value.publish.cctx)) | 141 | event->value.publish.cctx)) |
146 | GNUNET_SCHEDULER_add_continuation (sched, | 142 | GNUNET_SCHEDULER_add_continuation (&abort_publish_task, |
147 | &abort_publish_task, | ||
148 | NULL, | 143 | NULL, |
149 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 144 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
150 | break; | 145 | break; |
@@ -229,7 +224,6 @@ stop_arm (struct PeerContext *p) | |||
229 | 224 | ||
230 | static void | 225 | static void |
231 | run (void *cls, | 226 | run (void *cls, |
232 | struct GNUNET_SCHEDULER_Handle *s, | ||
233 | char *const *args, | 227 | char *const *args, |
234 | const char *cfgfile, | 228 | const char *cfgfile, |
235 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 229 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
@@ -246,10 +240,8 @@ run (void *cls, | |||
246 | struct GNUNET_FS_FileInformation *fidir; | 240 | struct GNUNET_FS_FileInformation *fidir; |
247 | size_t i; | 241 | size_t i; |
248 | 242 | ||
249 | sched = s; | ||
250 | setup_peer (&p1, "test_fs_list_indexed_data.conf"); | 243 | setup_peer (&p1, "test_fs_list_indexed_data.conf"); |
251 | fs = GNUNET_FS_start (sched, | 244 | fs = GNUNET_FS_start (cfg, |
252 | cfg, | ||
253 | "test-fs-list_indexed", | 245 | "test-fs-list_indexed", |
254 | &progress_cb, | 246 | &progress_cb, |
255 | NULL, | 247 | NULL, |
diff --git a/src/fs/test_fs_namespace.c b/src/fs/test_fs_namespace.c index b7641ab3b..0d37affa2 100644 --- a/src/fs/test_fs_namespace.c +++ b/src/fs/test_fs_namespace.c | |||
@@ -35,8 +35,6 @@ | |||
35 | 35 | ||
36 | #define START_ARM GNUNET_YES | 36 | #define START_ARM GNUNET_YES |
37 | 37 | ||
38 | static struct GNUNET_SCHEDULER_Handle *sched; | ||
39 | |||
40 | static struct PeerContext p1; | 38 | static struct PeerContext p1; |
41 | 39 | ||
42 | static GNUNET_HashCode nsid; | 40 | static GNUNET_HashCode nsid; |
@@ -151,8 +149,7 @@ progress_cb (void *cls, | |||
151 | err = 1; | 149 | err = 1; |
152 | } | 150 | } |
153 | /* give system 1ms to initiate update search! */ | 151 | /* give system 1ms to initiate update search! */ |
154 | GNUNET_SCHEDULER_add_delayed (sched, | 152 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MILLISECONDS, |
155 | GNUNET_TIME_UNIT_MILLISECONDS, | ||
156 | &abort_sks_search_task, | 153 | &abort_sks_search_task, |
157 | NULL); | 154 | NULL); |
158 | } | 155 | } |
@@ -165,8 +162,7 @@ progress_cb (void *cls, | |||
165 | "Wrong result for ksk search!\n"); | 162 | "Wrong result for ksk search!\n"); |
166 | err = 1; | 163 | err = 1; |
167 | } | 164 | } |
168 | GNUNET_SCHEDULER_add_continuation (sched, | 165 | GNUNET_SCHEDULER_add_continuation (&abort_ksk_search_task, |
169 | &abort_ksk_search_task, | ||
170 | NULL, | 166 | NULL, |
171 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 167 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
172 | } | 168 | } |
@@ -182,13 +178,11 @@ progress_cb (void *cls, | |||
182 | "Error searching file: %s\n", | 178 | "Error searching file: %s\n", |
183 | event->value.search.specifics.error.message); | 179 | event->value.search.specifics.error.message); |
184 | if (sks_search == event->value.search.sc) | 180 | if (sks_search == event->value.search.sc) |
185 | GNUNET_SCHEDULER_add_continuation (sched, | 181 | GNUNET_SCHEDULER_add_continuation (&abort_sks_search_task, |
186 | &abort_sks_search_task, | ||
187 | NULL, | 182 | NULL, |
188 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 183 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
189 | else if (ksk_search == event->value.search.sc) | 184 | else if (ksk_search == event->value.search.sc) |
190 | GNUNET_SCHEDULER_add_continuation (sched, | 185 | GNUNET_SCHEDULER_add_continuation (&abort_ksk_search_task, |
191 | &abort_ksk_search_task, | ||
192 | NULL, | 186 | NULL, |
193 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 187 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
194 | else | 188 | else |
@@ -384,15 +378,12 @@ testNamespace () | |||
384 | 378 | ||
385 | static void | 379 | static void |
386 | run (void *cls, | 380 | run (void *cls, |
387 | struct GNUNET_SCHEDULER_Handle *s, | ||
388 | char *const *args, | 381 | char *const *args, |
389 | const char *cfgfile, | 382 | const char *cfgfile, |
390 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 383 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
391 | { | 384 | { |
392 | sched = s; | ||
393 | setup_peer (&p1, "test_fs_namespace_data.conf"); | 385 | setup_peer (&p1, "test_fs_namespace_data.conf"); |
394 | fs = GNUNET_FS_start (sched, | 386 | fs = GNUNET_FS_start (cfg, |
395 | cfg, | ||
396 | "test-fs-namespace", | 387 | "test-fs-namespace", |
397 | &progress_cb, | 388 | &progress_cb, |
398 | NULL, | 389 | NULL, |
diff --git a/src/fs/test_fs_namespace_list_updateable.c b/src/fs/test_fs_namespace_list_updateable.c index 2637b1665..359800f56 100644 --- a/src/fs/test_fs_namespace_list_updateable.c +++ b/src/fs/test_fs_namespace_list_updateable.c | |||
@@ -32,8 +32,6 @@ | |||
32 | 32 | ||
33 | #define START_ARM GNUNET_YES | 33 | #define START_ARM GNUNET_YES |
34 | 34 | ||
35 | static struct GNUNET_SCHEDULER_Handle *sched; | ||
36 | |||
37 | static struct PeerContext p1; | 35 | static struct PeerContext p1; |
38 | 36 | ||
39 | static struct GNUNET_FS_Handle *fs; | 37 | static struct GNUNET_FS_Handle *fs; |
@@ -226,15 +224,12 @@ testNamespace () | |||
226 | 224 | ||
227 | static void | 225 | static void |
228 | run (void *cls, | 226 | run (void *cls, |
229 | struct GNUNET_SCHEDULER_Handle *s, | ||
230 | char *const *args, | 227 | char *const *args, |
231 | const char *cfgfile, | 228 | const char *cfgfile, |
232 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 229 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
233 | { | 230 | { |
234 | sched = s; | ||
235 | setup_peer (&p1, "test_fs_namespace_data.conf"); | 231 | setup_peer (&p1, "test_fs_namespace_data.conf"); |
236 | fs = GNUNET_FS_start (sched, | 232 | fs = GNUNET_FS_start (cfg, |
237 | cfg, | ||
238 | "test-fs-namespace", | 233 | "test-fs-namespace", |
239 | &progress_cb, | 234 | &progress_cb, |
240 | NULL, | 235 | NULL, |
diff --git a/src/fs/test_fs_publish.c b/src/fs/test_fs_publish.c index b5472ca93..327fa5a69 100644 --- a/src/fs/test_fs_publish.c +++ b/src/fs/test_fs_publish.c | |||
@@ -61,8 +61,6 @@ static struct PeerContext p1; | |||
61 | 61 | ||
62 | static struct GNUNET_TIME_Absolute start; | 62 | static struct GNUNET_TIME_Absolute start; |
63 | 63 | ||
64 | static struct GNUNET_SCHEDULER_Handle *sched; | ||
65 | |||
66 | static struct GNUNET_FS_Handle *fs; | 64 | static struct GNUNET_FS_Handle *fs; |
67 | 65 | ||
68 | static struct GNUNET_FS_PublishContext *publish; | 66 | static struct GNUNET_FS_PublishContext *publish; |
@@ -103,8 +101,7 @@ progress_cb (void *cls, | |||
103 | (unsigned long long) (FILESIZE * 1000 / (1+GNUNET_TIME_absolute_get_duration (start).rel_value) / 1024)); | 101 | (unsigned long long) (FILESIZE * 1000 / (1+GNUNET_TIME_absolute_get_duration (start).rel_value) / 1024)); |
104 | if (0 == strcmp ("publish-context-dir", | 102 | if (0 == strcmp ("publish-context-dir", |
105 | event->value.publish.cctx)) | 103 | event->value.publish.cctx)) |
106 | GNUNET_SCHEDULER_add_continuation (sched, | 104 | GNUNET_SCHEDULER_add_continuation (&abort_publish_task, |
107 | &abort_publish_task, | ||
108 | NULL, | 105 | NULL, |
109 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 106 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
110 | break; | 107 | break; |
@@ -130,8 +127,7 @@ progress_cb (void *cls, | |||
130 | { | 127 | { |
131 | fprintf (stderr, "Scheduling abort task for error on `%s'\n", | 128 | fprintf (stderr, "Scheduling abort task for error on `%s'\n", |
132 | (const char*) event->value.publish.cctx); | 129 | (const char*) event->value.publish.cctx); |
133 | GNUNET_SCHEDULER_add_continuation (sched, | 130 | GNUNET_SCHEDULER_add_continuation (&abort_publish_task, |
134 | &abort_publish_task, | ||
135 | NULL, | 131 | NULL, |
136 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 132 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
137 | } | 133 | } |
@@ -214,7 +210,6 @@ stop_arm (struct PeerContext *p) | |||
214 | 210 | ||
215 | static void | 211 | static void |
216 | run (void *cls, | 212 | run (void *cls, |
217 | struct GNUNET_SCHEDULER_Handle *s, | ||
218 | char *const *args, | 213 | char *const *args, |
219 | const char *cfgfile, | 214 | const char *cfgfile, |
220 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 215 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
@@ -231,10 +226,8 @@ run (void *cls, | |||
231 | struct GNUNET_FS_FileInformation *fidir; | 226 | struct GNUNET_FS_FileInformation *fidir; |
232 | size_t i; | 227 | size_t i; |
233 | 228 | ||
234 | sched = s; | ||
235 | setup_peer (&p1, "test_fs_publish_data.conf"); | 229 | setup_peer (&p1, "test_fs_publish_data.conf"); |
236 | fs = GNUNET_FS_start (sched, | 230 | fs = GNUNET_FS_start (cfg, |
237 | cfg, | ||
238 | "test-fs-publish", | 231 | "test-fs-publish", |
239 | &progress_cb, | 232 | &progress_cb, |
240 | NULL, | 233 | NULL, |
diff --git a/src/fs/test_fs_publish_persistence.c b/src/fs/test_fs_publish_persistence.c index b1260456b..52b2b270e 100644 --- a/src/fs/test_fs_publish_persistence.c +++ b/src/fs/test_fs_publish_persistence.c | |||
@@ -60,8 +60,6 @@ static struct PeerContext p1; | |||
60 | 60 | ||
61 | static struct GNUNET_TIME_Absolute start; | 61 | static struct GNUNET_TIME_Absolute start; |
62 | 62 | ||
63 | static struct GNUNET_SCHEDULER_Handle *sched; | ||
64 | |||
65 | static struct GNUNET_FS_Handle *fs; | 63 | static struct GNUNET_FS_Handle *fs; |
66 | 64 | ||
67 | static const struct GNUNET_CONFIGURATION_Handle *cfg; | 65 | static const struct GNUNET_CONFIGURATION_Handle *cfg; |
@@ -101,8 +99,7 @@ restart_fs_task (void *cls, | |||
101 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 99 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
102 | { | 100 | { |
103 | GNUNET_FS_stop (fs); | 101 | GNUNET_FS_stop (fs); |
104 | fs = GNUNET_FS_start (sched, | 102 | fs = GNUNET_FS_start (cfg, |
105 | cfg, | ||
106 | "test-fs-publish-persistence", | 103 | "test-fs-publish-persistence", |
107 | &progress_cb, | 104 | &progress_cb, |
108 | NULL, | 105 | NULL, |
@@ -128,8 +125,7 @@ consider_restart (int ev) | |||
128 | if (prev[i] == ev) | 125 | if (prev[i] == ev) |
129 | return; | 126 | return; |
130 | prev[off++] = ev; | 127 | prev[off++] = ev; |
131 | GNUNET_SCHEDULER_add_with_priority (sched, | 128 | GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_URGENT, |
132 | GNUNET_SCHEDULER_PRIORITY_URGENT, | ||
133 | &restart_fs_task, | 129 | &restart_fs_task, |
134 | NULL); | 130 | NULL); |
135 | } | 131 | } |
@@ -151,8 +147,7 @@ progress_cb (void *cls, | |||
151 | (unsigned long long) (FILESIZE * 1000 / (1+GNUNET_TIME_absolute_get_duration (start).rel_value) / 1024)); | 147 | (unsigned long long) (FILESIZE * 1000 / (1+GNUNET_TIME_absolute_get_duration (start).rel_value) / 1024)); |
152 | if (0 == strcmp ("publish-context-dir", | 148 | if (0 == strcmp ("publish-context-dir", |
153 | event->value.publish.cctx)) | 149 | event->value.publish.cctx)) |
154 | GNUNET_SCHEDULER_add_continuation (sched, | 150 | GNUNET_SCHEDULER_add_continuation (&abort_publish_task, |
155 | &abort_publish_task, | ||
156 | NULL, | 151 | NULL, |
157 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 152 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
158 | break; | 153 | break; |
@@ -187,8 +182,7 @@ progress_cb (void *cls, | |||
187 | err = 1; | 182 | err = 1; |
188 | if (0 == strcmp ("publish-context-dir", | 183 | if (0 == strcmp ("publish-context-dir", |
189 | event->value.publish.cctx)) | 184 | event->value.publish.cctx)) |
190 | GNUNET_SCHEDULER_add_continuation (sched, | 185 | GNUNET_SCHEDULER_add_continuation (&abort_publish_task, |
191 | &abort_publish_task, | ||
192 | NULL, | 186 | NULL, |
193 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 187 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
194 | break; | 188 | break; |
@@ -273,7 +267,6 @@ stop_arm (struct PeerContext *p) | |||
273 | 267 | ||
274 | static void | 268 | static void |
275 | run (void *cls, | 269 | run (void *cls, |
276 | struct GNUNET_SCHEDULER_Handle *s, | ||
277 | char *const *args, | 270 | char *const *args, |
278 | const char *cfgfile, | 271 | const char *cfgfile, |
279 | const struct GNUNET_CONFIGURATION_Handle *c) | 272 | const struct GNUNET_CONFIGURATION_Handle *c) |
@@ -290,11 +283,9 @@ run (void *cls, | |||
290 | struct GNUNET_FS_FileInformation *fidir; | 283 | struct GNUNET_FS_FileInformation *fidir; |
291 | size_t i; | 284 | size_t i; |
292 | 285 | ||
293 | sched = s; | ||
294 | cfg = c; | 286 | cfg = c; |
295 | setup_peer (&p1, "test_fs_publish_data.conf"); | 287 | setup_peer (&p1, "test_fs_publish_data.conf"); |
296 | fs = GNUNET_FS_start (sched, | 288 | fs = GNUNET_FS_start (cfg, |
297 | cfg, | ||
298 | "test-fs-publish-persistence", | 289 | "test-fs-publish-persistence", |
299 | &progress_cb, | 290 | &progress_cb, |
300 | NULL, | 291 | NULL, |
diff --git a/src/fs/test_fs_search.c b/src/fs/test_fs_search.c index 1609cd8e3..b003b75e1 100644 --- a/src/fs/test_fs_search.c +++ b/src/fs/test_fs_search.c | |||
@@ -61,8 +61,6 @@ static struct PeerContext p1; | |||
61 | 61 | ||
62 | static struct GNUNET_TIME_Absolute start; | 62 | static struct GNUNET_TIME_Absolute start; |
63 | 63 | ||
64 | static struct GNUNET_SCHEDULER_Handle *sched; | ||
65 | |||
66 | static struct GNUNET_FS_Handle *fs; | 64 | static struct GNUNET_FS_Handle *fs; |
67 | 65 | ||
68 | static struct GNUNET_FS_SearchContext *search; | 66 | static struct GNUNET_FS_SearchContext *search; |
@@ -124,8 +122,7 @@ progress_cb (void *cls, | |||
124 | #if VERBOSE | 122 | #if VERBOSE |
125 | printf ("Search complete.\n"); | 123 | printf ("Search complete.\n"); |
126 | #endif | 124 | #endif |
127 | GNUNET_SCHEDULER_add_continuation (sched, | 125 | GNUNET_SCHEDULER_add_continuation (&abort_search_task, |
128 | &abort_search_task, | ||
129 | NULL, | 126 | NULL, |
130 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 127 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
131 | break; | 128 | break; |
@@ -134,8 +131,7 @@ progress_cb (void *cls, | |||
134 | "Error publishing file: %s\n", | 131 | "Error publishing file: %s\n", |
135 | event->value.publish.specifics.error.message); | 132 | event->value.publish.specifics.error.message); |
136 | GNUNET_break (0); | 133 | GNUNET_break (0); |
137 | GNUNET_SCHEDULER_add_continuation (sched, | 134 | GNUNET_SCHEDULER_add_continuation (&abort_publish_task, |
138 | &abort_publish_task, | ||
139 | NULL, | 135 | NULL, |
140 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 136 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
141 | break; | 137 | break; |
@@ -143,8 +139,7 @@ progress_cb (void *cls, | |||
143 | fprintf (stderr, | 139 | fprintf (stderr, |
144 | "Error searching file: %s\n", | 140 | "Error searching file: %s\n", |
145 | event->value.search.specifics.error.message); | 141 | event->value.search.specifics.error.message); |
146 | GNUNET_SCHEDULER_add_continuation (sched, | 142 | GNUNET_SCHEDULER_add_continuation (&abort_search_task, |
147 | &abort_search_task, | ||
148 | NULL, | 143 | NULL, |
149 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 144 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
150 | break; | 145 | break; |
@@ -171,8 +166,7 @@ progress_cb (void *cls, | |||
171 | break; | 166 | break; |
172 | case GNUNET_FS_STATUS_SEARCH_STOPPED: | 167 | case GNUNET_FS_STATUS_SEARCH_STOPPED: |
173 | GNUNET_assert (search == event->value.search.sc); | 168 | GNUNET_assert (search == event->value.search.sc); |
174 | GNUNET_SCHEDULER_add_continuation (sched, | 169 | GNUNET_SCHEDULER_add_continuation (&abort_publish_task, |
175 | &abort_publish_task, | ||
176 | NULL, | 170 | NULL, |
177 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 171 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
178 | break; | 172 | break; |
@@ -221,7 +215,6 @@ stop_arm (struct PeerContext *p) | |||
221 | 215 | ||
222 | static void | 216 | static void |
223 | run (void *cls, | 217 | run (void *cls, |
224 | struct GNUNET_SCHEDULER_Handle *s, | ||
225 | char *const *args, | 218 | char *const *args, |
226 | const char *cfgfile, | 219 | const char *cfgfile, |
227 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 220 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
@@ -236,10 +229,8 @@ run (void *cls, | |||
236 | struct GNUNET_FS_FileInformation *fi; | 229 | struct GNUNET_FS_FileInformation *fi; |
237 | size_t i; | 230 | size_t i; |
238 | 231 | ||
239 | sched = s; | ||
240 | setup_peer (&p1, "test_fs_search_data.conf"); | 232 | setup_peer (&p1, "test_fs_search_data.conf"); |
241 | fs = GNUNET_FS_start (sched, | 233 | fs = GNUNET_FS_start (cfg, |
242 | cfg, | ||
243 | "test-fs-search", | 234 | "test-fs-search", |
244 | &progress_cb, | 235 | &progress_cb, |
245 | NULL, | 236 | NULL, |
diff --git a/src/fs/test_fs_search_persistence.c b/src/fs/test_fs_search_persistence.c index d755a9582..4def3fe6a 100644 --- a/src/fs/test_fs_search_persistence.c +++ b/src/fs/test_fs_search_persistence.c | |||
@@ -61,8 +61,6 @@ static struct PeerContext p1; | |||
61 | 61 | ||
62 | static struct GNUNET_TIME_Absolute start; | 62 | static struct GNUNET_TIME_Absolute start; |
63 | 63 | ||
64 | static struct GNUNET_SCHEDULER_Handle *sched; | ||
65 | |||
66 | static struct GNUNET_FS_Handle *fs; | 64 | static struct GNUNET_FS_Handle *fs; |
67 | 65 | ||
68 | static struct GNUNET_FS_SearchContext *search; | 66 | static struct GNUNET_FS_SearchContext *search; |
@@ -100,8 +98,7 @@ restart_fs_task (void *cls, | |||
100 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 98 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
101 | { | 99 | { |
102 | GNUNET_FS_stop (fs); | 100 | GNUNET_FS_stop (fs); |
103 | fs = GNUNET_FS_start (sched, | 101 | fs = GNUNET_FS_start (cfg, |
104 | cfg, | ||
105 | "test-fs-search-persistence", | 102 | "test-fs-search-persistence", |
106 | &progress_cb, | 103 | &progress_cb, |
107 | NULL, | 104 | NULL, |
@@ -129,8 +126,7 @@ consider_restart (int ev) | |||
129 | if (prev[i] == ev) | 126 | if (prev[i] == ev) |
130 | return; | 127 | return; |
131 | prev[off++] = ev; | 128 | prev[off++] = ev; |
132 | GNUNET_SCHEDULER_add_with_priority (sched, | 129 | GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_URGENT, |
133 | GNUNET_SCHEDULER_PRIORITY_URGENT, | ||
134 | &restart_fs_task, | 130 | &restart_fs_task, |
135 | NULL); | 131 | NULL); |
136 | } | 132 | } |
@@ -181,8 +177,7 @@ progress_cb (void *cls, | |||
181 | #if VERBOSE | 177 | #if VERBOSE |
182 | printf ("Search complete.\n"); | 178 | printf ("Search complete.\n"); |
183 | #endif | 179 | #endif |
184 | GNUNET_SCHEDULER_add_continuation (sched, | 180 | GNUNET_SCHEDULER_add_continuation (&abort_search_task, |
185 | &abort_search_task, | ||
186 | NULL, | 181 | NULL, |
187 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 182 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
188 | break; | 183 | break; |
@@ -191,8 +186,7 @@ progress_cb (void *cls, | |||
191 | "Error publishing file: %s\n", | 186 | "Error publishing file: %s\n", |
192 | event->value.publish.specifics.error.message); | 187 | event->value.publish.specifics.error.message); |
193 | GNUNET_break (0); | 188 | GNUNET_break (0); |
194 | GNUNET_SCHEDULER_add_continuation (sched, | 189 | GNUNET_SCHEDULER_add_continuation (&abort_publish_task, |
195 | &abort_publish_task, | ||
196 | NULL, | 190 | NULL, |
197 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 191 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
198 | break; | 192 | break; |
@@ -200,8 +194,7 @@ progress_cb (void *cls, | |||
200 | fprintf (stderr, | 194 | fprintf (stderr, |
201 | "Error searching file: %s\n", | 195 | "Error searching file: %s\n", |
202 | event->value.search.specifics.error.message); | 196 | event->value.search.specifics.error.message); |
203 | GNUNET_SCHEDULER_add_continuation (sched, | 197 | GNUNET_SCHEDULER_add_continuation (&abort_search_task, |
204 | &abort_search_task, | ||
205 | NULL, | 198 | NULL, |
206 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 199 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
207 | break; | 200 | break; |
@@ -241,8 +234,7 @@ progress_cb (void *cls, | |||
241 | break; | 234 | break; |
242 | case GNUNET_FS_STATUS_SEARCH_STOPPED: | 235 | case GNUNET_FS_STATUS_SEARCH_STOPPED: |
243 | GNUNET_assert (search == event->value.search.sc); | 236 | GNUNET_assert (search == event->value.search.sc); |
244 | GNUNET_SCHEDULER_add_continuation (sched, | 237 | GNUNET_SCHEDULER_add_continuation (&abort_publish_task, |
245 | &abort_publish_task, | ||
246 | NULL, | 238 | NULL, |
247 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 239 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
248 | search = NULL; | 240 | search = NULL; |
@@ -292,7 +284,6 @@ stop_arm (struct PeerContext *p) | |||
292 | 284 | ||
293 | static void | 285 | static void |
294 | run (void *cls, | 286 | run (void *cls, |
295 | struct GNUNET_SCHEDULER_Handle *s, | ||
296 | char *const *args, | 287 | char *const *args, |
297 | const char *cfgfile, | 288 | const char *cfgfile, |
298 | const struct GNUNET_CONFIGURATION_Handle *c) | 289 | const struct GNUNET_CONFIGURATION_Handle *c) |
@@ -307,11 +298,9 @@ run (void *cls, | |||
307 | struct GNUNET_FS_FileInformation *fi; | 298 | struct GNUNET_FS_FileInformation *fi; |
308 | size_t i; | 299 | size_t i; |
309 | 300 | ||
310 | sched = s; | ||
311 | cfg = c; | 301 | cfg = c; |
312 | setup_peer (&p1, "test_fs_search_data.conf"); | 302 | setup_peer (&p1, "test_fs_search_data.conf"); |
313 | fs = GNUNET_FS_start (sched, | 303 | fs = GNUNET_FS_start (cfg, |
314 | cfg, | ||
315 | "test-fs-search-persistence", | 304 | "test-fs-search-persistence", |
316 | &progress_cb, | 305 | &progress_cb, |
317 | NULL, | 306 | NULL, |
diff --git a/src/fs/test_fs_start_stop.c b/src/fs/test_fs_start_stop.c index f64596061..71043bf36 100644 --- a/src/fs/test_fs_start_stop.c +++ b/src/fs/test_fs_start_stop.c | |||
@@ -33,8 +33,6 @@ | |||
33 | 33 | ||
34 | #define START_ARM GNUNET_YES | 34 | #define START_ARM GNUNET_YES |
35 | 35 | ||
36 | static struct GNUNET_SCHEDULER_Handle *sched; | ||
37 | |||
38 | static struct PeerContext p1; | 36 | static struct PeerContext p1; |
39 | 37 | ||
40 | struct PeerContext | 38 | struct PeerContext |
@@ -89,17 +87,14 @@ stop_arm (struct PeerContext *p) | |||
89 | 87 | ||
90 | static void | 88 | static void |
91 | run (void *cls, | 89 | run (void *cls, |
92 | struct GNUNET_SCHEDULER_Handle *s, | ||
93 | char *const *args, | 90 | char *const *args, |
94 | const char *cfgfile, | 91 | const char *cfgfile, |
95 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 92 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
96 | { | 93 | { |
97 | struct GNUNET_FS_Handle *fs; | 94 | struct GNUNET_FS_Handle *fs; |
98 | 95 | ||
99 | sched = s; | ||
100 | setup_peer (&p1, "test_fs_data.conf"); | 96 | setup_peer (&p1, "test_fs_data.conf"); |
101 | fs = GNUNET_FS_start (sched, | 97 | fs = GNUNET_FS_start (cfg, |
102 | cfg, | ||
103 | "test-fs-start-stop", | 98 | "test-fs-start-stop", |
104 | &progress_cb, | 99 | &progress_cb, |
105 | NULL, | 100 | NULL, |
diff --git a/src/fs/test_fs_test_lib.c b/src/fs/test_fs_test_lib.c index 930038da5..3c6826181 100644 --- a/src/fs/test_fs_test_lib.c +++ b/src/fs/test_fs_test_lib.c | |||
@@ -44,8 +44,6 @@ | |||
44 | 44 | ||
45 | static struct GNUNET_FS_TestDaemon *daemons[NUM_DAEMONS]; | 45 | static struct GNUNET_FS_TestDaemon *daemons[NUM_DAEMONS]; |
46 | 46 | ||
47 | static struct GNUNET_SCHEDULER_Handle *sched; | ||
48 | |||
49 | static int ret; | 47 | static int ret; |
50 | 48 | ||
51 | static void | 49 | static void |
@@ -63,8 +61,7 @@ do_stop (void *cls, | |||
63 | "Finished download, shutting down\n", | 61 | "Finished download, shutting down\n", |
64 | (unsigned long long) FILESIZE); | 62 | (unsigned long long) FILESIZE); |
65 | } | 63 | } |
66 | GNUNET_FS_TEST_daemons_stop (sched, | 64 | GNUNET_FS_TEST_daemons_stop (NUM_DAEMONS, |
67 | NUM_DAEMONS, | ||
68 | daemons); | 65 | daemons); |
69 | } | 66 | } |
70 | 67 | ||
@@ -76,8 +73,7 @@ do_download (void *cls, | |||
76 | if (NULL == uri) | 73 | if (NULL == uri) |
77 | { | 74 | { |
78 | GNUNET_break (0); | 75 | GNUNET_break (0); |
79 | GNUNET_SCHEDULER_add_now (sched, | 76 | GNUNET_SCHEDULER_add_now (&do_stop, |
80 | &do_stop, | ||
81 | NULL); | 77 | NULL); |
82 | ret = 1; | 78 | ret = 1; |
83 | return; | 79 | return; |
@@ -85,8 +81,7 @@ do_download (void *cls, | |||
85 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 81 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
86 | "Downloading %llu bytes\n", | 82 | "Downloading %llu bytes\n", |
87 | (unsigned long long) FILESIZE); | 83 | (unsigned long long) FILESIZE); |
88 | GNUNET_FS_TEST_download (sched, | 84 | GNUNET_FS_TEST_download (daemons[0], |
89 | daemons[0], | ||
90 | TIMEOUT, | 85 | TIMEOUT, |
91 | 1, SEED, uri, | 86 | 1, SEED, uri, |
92 | VERBOSE, | 87 | VERBOSE, |
@@ -102,16 +97,14 @@ do_publish (void *cls, | |||
102 | { | 97 | { |
103 | GNUNET_break (0); | 98 | GNUNET_break (0); |
104 | ret = 1; | 99 | ret = 1; |
105 | GNUNET_SCHEDULER_add_now (sched, | 100 | GNUNET_SCHEDULER_add_now (&do_stop, |
106 | &do_stop, | ||
107 | NULL); | 101 | NULL); |
108 | return; | 102 | return; |
109 | } | 103 | } |
110 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 104 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
111 | "Publishing %llu bytes\n", | 105 | "Publishing %llu bytes\n", |
112 | (unsigned long long) FILESIZE); | 106 | (unsigned long long) FILESIZE); |
113 | GNUNET_FS_TEST_publish (sched, | 107 | GNUNET_FS_TEST_publish (daemons[0], |
114 | daemons[0], | ||
115 | TIMEOUT, | 108 | TIMEOUT, |
116 | 1, GNUNET_NO, FILESIZE, SEED, | 109 | 1, GNUNET_NO, FILESIZE, SEED, |
117 | VERBOSE, | 110 | VERBOSE, |
@@ -127,15 +120,13 @@ do_connect (void *cls, | |||
127 | { | 120 | { |
128 | GNUNET_break (0); | 121 | GNUNET_break (0); |
129 | ret = 1; | 122 | ret = 1; |
130 | GNUNET_SCHEDULER_add_now (sched, | 123 | GNUNET_SCHEDULER_add_now (&do_stop, |
131 | &do_stop, | ||
132 | NULL); | 124 | NULL); |
133 | return; | 125 | return; |
134 | } | 126 | } |
135 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 127 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
136 | "Daemons started, will now try to connect them\n"); | 128 | "Daemons started, will now try to connect them\n"); |
137 | GNUNET_FS_TEST_daemons_connect (sched, | 129 | GNUNET_FS_TEST_daemons_connect (daemons[0], |
138 | daemons[0], | ||
139 | daemons[1], | 130 | daemons[1], |
140 | TIMEOUT, | 131 | TIMEOUT, |
141 | &do_publish, | 132 | &do_publish, |
@@ -145,14 +136,11 @@ do_connect (void *cls, | |||
145 | 136 | ||
146 | static void | 137 | static void |
147 | run (void *cls, | 138 | run (void *cls, |
148 | struct GNUNET_SCHEDULER_Handle *s, | ||
149 | char *const *args, | 139 | char *const *args, |
150 | const char *cfgfile, | 140 | const char *cfgfile, |
151 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 141 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
152 | { | 142 | { |
153 | sched = s; | 143 | GNUNET_FS_TEST_daemons_start ("fs_test_lib_data.conf", |
154 | GNUNET_FS_TEST_daemons_start (sched, | ||
155 | "fs_test_lib_data.conf", | ||
156 | TIMEOUT, | 144 | TIMEOUT, |
157 | NUM_DAEMONS, | 145 | NUM_DAEMONS, |
158 | daemons, | 146 | daemons, |
diff --git a/src/fs/test_fs_unindex.c b/src/fs/test_fs_unindex.c index 7adc4d229..e2c0e86ee 100644 --- a/src/fs/test_fs_unindex.c +++ b/src/fs/test_fs_unindex.c | |||
@@ -60,8 +60,6 @@ static struct PeerContext p1; | |||
60 | 60 | ||
61 | static struct GNUNET_TIME_Absolute start; | 61 | static struct GNUNET_TIME_Absolute start; |
62 | 62 | ||
63 | static struct GNUNET_SCHEDULER_Handle *sched; | ||
64 | |||
65 | static struct GNUNET_FS_Handle *fs; | 63 | static struct GNUNET_FS_Handle *fs; |
66 | 64 | ||
67 | static struct GNUNET_FS_UnindexContext *unindex; | 65 | static struct GNUNET_FS_UnindexContext *unindex; |
@@ -120,8 +118,7 @@ progress_cb (void *cls, | |||
120 | case GNUNET_FS_STATUS_UNINDEX_COMPLETED: | 118 | case GNUNET_FS_STATUS_UNINDEX_COMPLETED: |
121 | printf ("Unindex complete, %llu kbps.\n", | 119 | printf ("Unindex complete, %llu kbps.\n", |
122 | (unsigned long long) (FILESIZE * 1000 / (1+GNUNET_TIME_absolute_get_duration (start).rel_value) / 1024)); | 120 | (unsigned long long) (FILESIZE * 1000 / (1+GNUNET_TIME_absolute_get_duration (start).rel_value) / 1024)); |
123 | GNUNET_SCHEDULER_add_continuation (sched, | 121 | GNUNET_SCHEDULER_add_continuation (&abort_unindex_task, |
124 | &abort_unindex_task, | ||
125 | NULL, | 122 | NULL, |
126 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 123 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
127 | break; | 124 | break; |
@@ -140,8 +137,7 @@ progress_cb (void *cls, | |||
140 | "Error publishing file: %s\n", | 137 | "Error publishing file: %s\n", |
141 | event->value.publish.specifics.error.message); | 138 | event->value.publish.specifics.error.message); |
142 | GNUNET_break (0); | 139 | GNUNET_break (0); |
143 | GNUNET_SCHEDULER_add_continuation (sched, | 140 | GNUNET_SCHEDULER_add_continuation (&abort_publish_task, |
144 | &abort_publish_task, | ||
145 | NULL, | 141 | NULL, |
146 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 142 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
147 | break; | 143 | break; |
@@ -149,8 +145,7 @@ progress_cb (void *cls, | |||
149 | fprintf (stderr, | 145 | fprintf (stderr, |
150 | "Error unindexing file: %s\n", | 146 | "Error unindexing file: %s\n", |
151 | event->value.unindex.specifics.error.message); | 147 | event->value.unindex.specifics.error.message); |
152 | GNUNET_SCHEDULER_add_continuation (sched, | 148 | GNUNET_SCHEDULER_add_continuation (&abort_unindex_task, |
153 | &abort_unindex_task, | ||
154 | NULL, | 149 | NULL, |
155 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 150 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
156 | break; | 151 | break; |
@@ -177,8 +172,7 @@ progress_cb (void *cls, | |||
177 | break; | 172 | break; |
178 | case GNUNET_FS_STATUS_UNINDEX_STOPPED: | 173 | case GNUNET_FS_STATUS_UNINDEX_STOPPED: |
179 | GNUNET_assert (unindex == event->value.unindex.uc); | 174 | GNUNET_assert (unindex == event->value.unindex.uc); |
180 | GNUNET_SCHEDULER_add_continuation (sched, | 175 | GNUNET_SCHEDULER_add_continuation (&abort_publish_task, |
181 | &abort_publish_task, | ||
182 | NULL, | 176 | NULL, |
183 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 177 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
184 | break; | 178 | break; |
@@ -226,7 +220,6 @@ stop_arm (struct PeerContext *p) | |||
226 | 220 | ||
227 | static void | 221 | static void |
228 | run (void *cls, | 222 | run (void *cls, |
229 | struct GNUNET_SCHEDULER_Handle *s, | ||
230 | char *const *args, | 223 | char *const *args, |
231 | const char *cfgfile, | 224 | const char *cfgfile, |
232 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 225 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
@@ -241,11 +234,9 @@ run (void *cls, | |||
241 | struct GNUNET_FS_FileInformation *fi; | 234 | struct GNUNET_FS_FileInformation *fi; |
242 | size_t i; | 235 | size_t i; |
243 | 236 | ||
244 | sched = s; | ||
245 | setup_peer (&p1, "test_fs_unindex_data.conf"); | 237 | setup_peer (&p1, "test_fs_unindex_data.conf"); |
246 | fn = GNUNET_DISK_mktemp ("gnunet-unindex-test-dst"); | 238 | fn = GNUNET_DISK_mktemp ("gnunet-unindex-test-dst"); |
247 | fs = GNUNET_FS_start (sched, | 239 | fs = GNUNET_FS_start (cfg, |
248 | cfg, | ||
249 | "test-fs-unindex", | 240 | "test-fs-unindex", |
250 | &progress_cb, | 241 | &progress_cb, |
251 | NULL, | 242 | NULL, |
diff --git a/src/fs/test_fs_unindex_persistence.c b/src/fs/test_fs_unindex_persistence.c index 42f047b70..eec181544 100644 --- a/src/fs/test_fs_unindex_persistence.c +++ b/src/fs/test_fs_unindex_persistence.c | |||
@@ -59,8 +59,6 @@ static struct PeerContext p1; | |||
59 | 59 | ||
60 | static struct GNUNET_TIME_Absolute start; | 60 | static struct GNUNET_TIME_Absolute start; |
61 | 61 | ||
62 | static struct GNUNET_SCHEDULER_Handle *sched; | ||
63 | |||
64 | static struct GNUNET_FS_Handle *fs; | 62 | static struct GNUNET_FS_Handle *fs; |
65 | 63 | ||
66 | static struct GNUNET_FS_UnindexContext *unindex; | 64 | static struct GNUNET_FS_UnindexContext *unindex; |
@@ -108,8 +106,7 @@ restart_fs_task (void *cls, | |||
108 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 106 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
109 | { | 107 | { |
110 | GNUNET_FS_stop (fs); | 108 | GNUNET_FS_stop (fs); |
111 | fs = GNUNET_FS_start (sched, | 109 | fs = GNUNET_FS_start (cfg, |
112 | cfg, | ||
113 | "test-fs-unindex-persistence", | 110 | "test-fs-unindex-persistence", |
114 | &progress_cb, | 111 | &progress_cb, |
115 | NULL, | 112 | NULL, |
@@ -135,8 +132,7 @@ consider_restart (int ev) | |||
135 | if (prev[i] == ev) | 132 | if (prev[i] == ev) |
136 | return; | 133 | return; |
137 | prev[off++] = ev; | 134 | prev[off++] = ev; |
138 | GNUNET_SCHEDULER_add_with_priority (sched, | 135 | GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_URGENT, |
139 | GNUNET_SCHEDULER_PRIORITY_URGENT, | ||
140 | &restart_fs_task, | 136 | &restart_fs_task, |
141 | NULL); | 137 | NULL); |
142 | } | 138 | } |
@@ -169,8 +165,7 @@ progress_cb (void *cls, | |||
169 | case GNUNET_FS_STATUS_UNINDEX_COMPLETED: | 165 | case GNUNET_FS_STATUS_UNINDEX_COMPLETED: |
170 | printf ("Unindex complete, %llu kbps.\n", | 166 | printf ("Unindex complete, %llu kbps.\n", |
171 | (unsigned long long) (FILESIZE * 1000 / (1+GNUNET_TIME_absolute_get_duration (start).rel_value) / 1024)); | 167 | (unsigned long long) (FILESIZE * 1000 / (1+GNUNET_TIME_absolute_get_duration (start).rel_value) / 1024)); |
172 | GNUNET_SCHEDULER_add_continuation (sched, | 168 | GNUNET_SCHEDULER_add_continuation (&abort_unindex_task, |
173 | &abort_unindex_task, | ||
174 | NULL, | 169 | NULL, |
175 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 170 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
176 | break; | 171 | break; |
@@ -209,8 +204,7 @@ progress_cb (void *cls, | |||
209 | "Error publishing file: %s\n", | 204 | "Error publishing file: %s\n", |
210 | event->value.publish.specifics.error.message); | 205 | event->value.publish.specifics.error.message); |
211 | GNUNET_break (0); | 206 | GNUNET_break (0); |
212 | GNUNET_SCHEDULER_add_continuation (sched, | 207 | GNUNET_SCHEDULER_add_continuation (&abort_publish_task, |
213 | &abort_publish_task, | ||
214 | NULL, | 208 | NULL, |
215 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 209 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
216 | break; | 210 | break; |
@@ -218,8 +212,7 @@ progress_cb (void *cls, | |||
218 | fprintf (stderr, | 212 | fprintf (stderr, |
219 | "Error unindexing file: %s\n", | 213 | "Error unindexing file: %s\n", |
220 | event->value.unindex.specifics.error.message); | 214 | event->value.unindex.specifics.error.message); |
221 | GNUNET_SCHEDULER_add_continuation (sched, | 215 | GNUNET_SCHEDULER_add_continuation (&abort_unindex_task, |
222 | &abort_unindex_task, | ||
223 | NULL, | 216 | NULL, |
224 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 217 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
225 | break; | 218 | break; |
@@ -247,8 +240,7 @@ progress_cb (void *cls, | |||
247 | break; | 240 | break; |
248 | case GNUNET_FS_STATUS_UNINDEX_STOPPED: | 241 | case GNUNET_FS_STATUS_UNINDEX_STOPPED: |
249 | GNUNET_assert (unindex == event->value.unindex.uc); | 242 | GNUNET_assert (unindex == event->value.unindex.uc); |
250 | GNUNET_SCHEDULER_add_continuation (sched, | 243 | GNUNET_SCHEDULER_add_continuation (&abort_publish_task, |
251 | &abort_publish_task, | ||
252 | NULL, | 244 | NULL, |
253 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 245 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
254 | break; | 246 | break; |
@@ -296,7 +288,6 @@ stop_arm (struct PeerContext *p) | |||
296 | 288 | ||
297 | static void | 289 | static void |
298 | run (void *cls, | 290 | run (void *cls, |
299 | struct GNUNET_SCHEDULER_Handle *s, | ||
300 | char *const *args, | 291 | char *const *args, |
301 | const char *cfgfile, | 292 | const char *cfgfile, |
302 | const struct GNUNET_CONFIGURATION_Handle *c) | 293 | const struct GNUNET_CONFIGURATION_Handle *c) |
@@ -311,12 +302,10 @@ run (void *cls, | |||
311 | struct GNUNET_FS_FileInformation *fi; | 302 | struct GNUNET_FS_FileInformation *fi; |
312 | size_t i; | 303 | size_t i; |
313 | 304 | ||
314 | sched = s; | ||
315 | cfg = c; | 305 | cfg = c; |
316 | setup_peer (&p1, "test_fs_unindex_data.conf"); | 306 | setup_peer (&p1, "test_fs_unindex_data.conf"); |
317 | fn = GNUNET_DISK_mktemp ("gnunet-unindex-test-dst"); | 307 | fn = GNUNET_DISK_mktemp ("gnunet-unindex-test-dst"); |
318 | fs = GNUNET_FS_start (sched, | 308 | fs = GNUNET_FS_start (cfg, |
319 | cfg, | ||
320 | "test-fs-unindex-persistence", | 309 | "test-fs-unindex-persistence", |
321 | &progress_cb, | 310 | &progress_cb, |
322 | NULL, | 311 | NULL, |
diff --git a/src/fs/test_gnunet_service_fs_migration.c b/src/fs/test_gnunet_service_fs_migration.c index 3d6afbdc2..092cedfc2 100644 --- a/src/fs/test_gnunet_service_fs_migration.c +++ b/src/fs/test_gnunet_service_fs_migration.c | |||
@@ -48,8 +48,6 @@ | |||
48 | 48 | ||
49 | static struct GNUNET_FS_TestDaemon *daemons[2]; | 49 | static struct GNUNET_FS_TestDaemon *daemons[2]; |
50 | 50 | ||
51 | static struct GNUNET_SCHEDULER_Handle *sched; | ||
52 | |||
53 | static int ok; | 51 | static int ok; |
54 | 52 | ||
55 | static struct GNUNET_TIME_Absolute start_time; | 53 | static struct GNUNET_TIME_Absolute start_time; |
@@ -61,8 +59,7 @@ do_stop (void *cls, | |||
61 | struct GNUNET_TIME_Relative del; | 59 | struct GNUNET_TIME_Relative del; |
62 | char *fancy; | 60 | char *fancy; |
63 | 61 | ||
64 | GNUNET_FS_TEST_daemons_stop (sched, | 62 | GNUNET_FS_TEST_daemons_stop (2, |
65 | 2, | ||
66 | daemons); | 63 | daemons); |
67 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE)) | 64 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE)) |
68 | { | 65 | { |
@@ -95,8 +92,7 @@ do_download (void *cls, | |||
95 | 92 | ||
96 | if (emsg != NULL) | 93 | if (emsg != NULL) |
97 | { | 94 | { |
98 | GNUNET_FS_TEST_daemons_stop (sched, | 95 | GNUNET_FS_TEST_daemons_stop (2, |
99 | 2, | ||
100 | daemons); | 96 | daemons); |
101 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 97 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
102 | "Failed to stop source daemon: %s\n", | 98 | "Failed to stop source daemon: %s\n", |
@@ -109,8 +105,7 @@ do_download (void *cls, | |||
109 | "Downloading %llu bytes\n", | 105 | "Downloading %llu bytes\n", |
110 | (unsigned long long) FILESIZE); | 106 | (unsigned long long) FILESIZE); |
111 | start_time = GNUNET_TIME_absolute_get (); | 107 | start_time = GNUNET_TIME_absolute_get (); |
112 | GNUNET_FS_TEST_download (sched, | 108 | GNUNET_FS_TEST_download (daemons[0], |
113 | daemons[0], | ||
114 | TIMEOUT, | 109 | TIMEOUT, |
115 | 1, SEED, uri, | 110 | 1, SEED, uri, |
116 | VERBOSE, | 111 | VERBOSE, |
@@ -143,8 +138,7 @@ do_wait (void *cls, | |||
143 | 138 | ||
144 | if (NULL == uri) | 139 | if (NULL == uri) |
145 | { | 140 | { |
146 | GNUNET_FS_TEST_daemons_stop (sched, | 141 | GNUNET_FS_TEST_daemons_stop (2, |
147 | 2, | ||
148 | daemons); | 142 | daemons); |
149 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 143 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
150 | "Timeout during upload attempt, shutting down with error\n"); | 144 | "Timeout during upload attempt, shutting down with error\n"); |
@@ -154,8 +148,7 @@ do_wait (void *cls, | |||
154 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 148 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
155 | "Waiting to allow content to migrate\n"); | 149 | "Waiting to allow content to migrate\n"); |
156 | d = GNUNET_FS_uri_dup (uri); | 150 | d = GNUNET_FS_uri_dup (uri); |
157 | (void) GNUNET_SCHEDULER_add_delayed (sched, | 151 | (void) GNUNET_SCHEDULER_add_delayed (MIGRATION_DELAY, |
158 | MIGRATION_DELAY, | ||
159 | &stop_source_peer, | 152 | &stop_source_peer, |
160 | d); | 153 | d); |
161 | } | 154 | } |
@@ -167,8 +160,7 @@ do_publish (void *cls, | |||
167 | { | 160 | { |
168 | if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE)) | 161 | if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE)) |
169 | { | 162 | { |
170 | GNUNET_FS_TEST_daemons_stop (sched, | 163 | GNUNET_FS_TEST_daemons_stop (2, |
171 | 2, | ||
172 | daemons); | 164 | daemons); |
173 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 165 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
174 | "Timeout during connect attempt, shutting down with error\n"); | 166 | "Timeout during connect attempt, shutting down with error\n"); |
@@ -178,8 +170,7 @@ do_publish (void *cls, | |||
178 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 170 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
179 | "Publishing %llu bytes\n", | 171 | "Publishing %llu bytes\n", |
180 | (unsigned long long) FILESIZE); | 172 | (unsigned long long) FILESIZE); |
181 | GNUNET_FS_TEST_publish (sched, | 173 | GNUNET_FS_TEST_publish (daemons[1], |
182 | daemons[1], | ||
183 | TIMEOUT, | 174 | TIMEOUT, |
184 | 1, GNUNET_NO, FILESIZE, SEED, | 175 | 1, GNUNET_NO, FILESIZE, SEED, |
185 | VERBOSE, | 176 | VERBOSE, |
@@ -201,8 +192,7 @@ do_connect (void *cls, | |||
201 | } | 192 | } |
202 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 193 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
203 | "Daemons started, will now try to connect them\n"); | 194 | "Daemons started, will now try to connect them\n"); |
204 | GNUNET_FS_TEST_daemons_connect (sched, | 195 | GNUNET_FS_TEST_daemons_connect (daemons[0], |
205 | daemons[0], | ||
206 | daemons[1], | 196 | daemons[1], |
207 | TIMEOUT, | 197 | TIMEOUT, |
208 | &do_publish, | 198 | &do_publish, |
@@ -212,14 +202,11 @@ do_connect (void *cls, | |||
212 | 202 | ||
213 | static void | 203 | static void |
214 | run (void *cls, | 204 | run (void *cls, |
215 | struct GNUNET_SCHEDULER_Handle *s, | ||
216 | char *const *args, | 205 | char *const *args, |
217 | const char *cfgfile, | 206 | const char *cfgfile, |
218 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 207 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
219 | { | 208 | { |
220 | sched = s; | 209 | GNUNET_FS_TEST_daemons_start ("test_gnunet_service_fs_migration_data.conf", |
221 | GNUNET_FS_TEST_daemons_start (sched, | ||
222 | "test_gnunet_service_fs_migration_data.conf", | ||
223 | TIMEOUT, | 210 | TIMEOUT, |
224 | 2, | 211 | 2, |
225 | daemons, | 212 | daemons, |
diff --git a/src/fs/test_gnunet_service_fs_p2p.c b/src/fs/test_gnunet_service_fs_p2p.c index f026baf6b..3bb808c48 100644 --- a/src/fs/test_gnunet_service_fs_p2p.c +++ b/src/fs/test_gnunet_service_fs_p2p.c | |||
@@ -44,8 +44,6 @@ | |||
44 | 44 | ||
45 | static struct GNUNET_FS_TestDaemon *daemons[NUM_DAEMONS]; | 45 | static struct GNUNET_FS_TestDaemon *daemons[NUM_DAEMONS]; |
46 | 46 | ||
47 | static struct GNUNET_SCHEDULER_Handle *sched; | ||
48 | |||
49 | static int ok; | 47 | static int ok; |
50 | 48 | ||
51 | static struct GNUNET_TIME_Absolute start_time; | 49 | static struct GNUNET_TIME_Absolute start_time; |
@@ -57,8 +55,7 @@ do_stop (void *cls, | |||
57 | struct GNUNET_TIME_Relative del; | 55 | struct GNUNET_TIME_Relative del; |
58 | char *fancy; | 56 | char *fancy; |
59 | 57 | ||
60 | GNUNET_FS_TEST_daemons_stop (sched, | 58 | GNUNET_FS_TEST_daemons_stop (NUM_DAEMONS, |
61 | NUM_DAEMONS, | ||
62 | daemons); | 59 | daemons); |
63 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE)) | 60 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE)) |
64 | { | 61 | { |
@@ -89,8 +86,7 @@ do_download (void *cls, | |||
89 | { | 86 | { |
90 | if (NULL == uri) | 87 | if (NULL == uri) |
91 | { | 88 | { |
92 | GNUNET_FS_TEST_daemons_stop (sched, | 89 | GNUNET_FS_TEST_daemons_stop (NUM_DAEMONS, |
93 | NUM_DAEMONS, | ||
94 | daemons); | 90 | daemons); |
95 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 91 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
96 | "Timeout during upload attempt, shutting down with error\n"); | 92 | "Timeout during upload attempt, shutting down with error\n"); |
@@ -101,8 +97,7 @@ do_download (void *cls, | |||
101 | "Downloading %llu bytes\n", | 97 | "Downloading %llu bytes\n", |
102 | (unsigned long long) FILESIZE); | 98 | (unsigned long long) FILESIZE); |
103 | start_time = GNUNET_TIME_absolute_get (); | 99 | start_time = GNUNET_TIME_absolute_get (); |
104 | GNUNET_FS_TEST_download (sched, | 100 | GNUNET_FS_TEST_download (daemons[0], |
105 | daemons[0], | ||
106 | TIMEOUT, | 101 | TIMEOUT, |
107 | 1, SEED, uri, | 102 | 1, SEED, uri, |
108 | VERBOSE, | 103 | VERBOSE, |
@@ -116,8 +111,7 @@ do_publish (void *cls, | |||
116 | { | 111 | { |
117 | if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE)) | 112 | if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE)) |
118 | { | 113 | { |
119 | GNUNET_FS_TEST_daemons_stop (sched, | 114 | GNUNET_FS_TEST_daemons_stop (NUM_DAEMONS, |
120 | NUM_DAEMONS, | ||
121 | daemons); | 115 | daemons); |
122 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 116 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
123 | "Timeout during connect attempt, shutting down with error\n"); | 117 | "Timeout during connect attempt, shutting down with error\n"); |
@@ -127,8 +121,7 @@ do_publish (void *cls, | |||
127 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 121 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
128 | "Publishing %llu bytes\n", | 122 | "Publishing %llu bytes\n", |
129 | (unsigned long long) FILESIZE); | 123 | (unsigned long long) FILESIZE); |
130 | GNUNET_FS_TEST_publish (sched, | 124 | GNUNET_FS_TEST_publish (daemons[1], |
131 | daemons[1], | ||
132 | TIMEOUT, | 125 | TIMEOUT, |
133 | 1, GNUNET_NO, FILESIZE, SEED, | 126 | 1, GNUNET_NO, FILESIZE, SEED, |
134 | VERBOSE, | 127 | VERBOSE, |
@@ -143,8 +136,7 @@ do_connect (void *cls, | |||
143 | GNUNET_assert (0 != (tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE)); | 136 | GNUNET_assert (0 != (tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE)); |
144 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 137 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
145 | "Daemons started, will now try to connect them\n"); | 138 | "Daemons started, will now try to connect them\n"); |
146 | GNUNET_FS_TEST_daemons_connect (sched, | 139 | GNUNET_FS_TEST_daemons_connect (daemons[0], |
147 | daemons[0], | ||
148 | daemons[1], | 140 | daemons[1], |
149 | TIMEOUT, | 141 | TIMEOUT, |
150 | &do_publish, | 142 | &do_publish, |
@@ -154,14 +146,11 @@ do_connect (void *cls, | |||
154 | 146 | ||
155 | static void | 147 | static void |
156 | run (void *cls, | 148 | run (void *cls, |
157 | struct GNUNET_SCHEDULER_Handle *s, | ||
158 | char *const *args, | 149 | char *const *args, |
159 | const char *cfgfile, | 150 | const char *cfgfile, |
160 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 151 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
161 | { | 152 | { |
162 | sched = s; | 153 | GNUNET_FS_TEST_daemons_start ("fs_test_lib_data.conf", |
163 | GNUNET_FS_TEST_daemons_start (sched, | ||
164 | "fs_test_lib_data.conf", | ||
165 | TIMEOUT, | 154 | TIMEOUT, |
166 | NUM_DAEMONS, | 155 | NUM_DAEMONS, |
167 | daemons, | 156 | daemons, |