aboutsummaryrefslogtreecommitdiff
path: root/src/fs/fs_publish.c
diff options
context:
space:
mode:
authorNathan S. Evans <evans@in.tum.de>2010-11-05 18:21:50 +0000
committerNathan S. Evans <evans@in.tum.de>2010-11-05 18:21:50 +0000
commit75a33a1499cf60ea4364c9aa673816629a6c1413 (patch)
tree0620da4312bb04de4d7b65074fdd3b0c3dd6cc0e /src/fs/fs_publish.c
parent7217c601ad30760872823193d62307e7a335d226 (diff)
downloadgnunet-75a33a1499cf60ea4364c9aa673816629a6c1413.tar.gz
gnunet-75a33a1499cf60ea4364c9aa673816629a6c1413.zip
big scheduler refactoring, expect some issues
Diffstat (limited to 'src/fs/fs_publish.c')
-rw-r--r--src/fs/fs_publish.c46
1 files changed, 16 insertions, 30 deletions
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}