diff options
Diffstat (limited to 'src/dht/dht_api.c')
-rw-r--r-- | src/dht/dht_api.c | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/src/dht/dht_api.c b/src/dht/dht_api.c index d04e4d206..68e662269 100644 --- a/src/dht/dht_api.c +++ b/src/dht/dht_api.c | |||
@@ -149,10 +149,6 @@ struct GNUNET_DHT_RouteHandle | |||
149 | */ | 149 | */ |
150 | struct GNUNET_DHT_Handle | 150 | struct GNUNET_DHT_Handle |
151 | { | 151 | { |
152 | /** | ||
153 | * Our scheduler. | ||
154 | */ | ||
155 | struct GNUNET_SCHEDULER_Handle *sched; | ||
156 | 152 | ||
157 | /** | 153 | /** |
158 | * Configuration to use. | 154 | * Configuration to use. |
@@ -224,7 +220,7 @@ try_connect (struct GNUNET_DHT_Handle *handle) | |||
224 | { | 220 | { |
225 | if (handle->client != NULL) | 221 | if (handle->client != NULL) |
226 | return GNUNET_OK; | 222 | return GNUNET_OK; |
227 | handle->client = GNUNET_CLIENT_connect (handle->sched, "dht", handle->cfg); | 223 | handle->client = GNUNET_CLIENT_connect ("dht", handle->cfg); |
228 | if (handle->client == NULL) | 224 | if (handle->client == NULL) |
229 | { | 225 | { |
230 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 226 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
@@ -359,14 +355,12 @@ transmit_pending (void *cls, | |||
359 | head); | 355 | head); |
360 | if (head->timeout_task != GNUNET_SCHEDULER_NO_TASK) | 356 | if (head->timeout_task != GNUNET_SCHEDULER_NO_TASK) |
361 | { | 357 | { |
362 | GNUNET_SCHEDULER_cancel (handle->sched, | 358 | GNUNET_SCHEDULER_cancel (head->timeout_task); |
363 | head->timeout_task); | ||
364 | head->timeout_task = GNUNET_SCHEDULER_NO_TASK; | 359 | head->timeout_task = GNUNET_SCHEDULER_NO_TASK; |
365 | } | 360 | } |
366 | if (NULL != head->cont) | 361 | if (NULL != head->cont) |
367 | { | 362 | { |
368 | GNUNET_SCHEDULER_add_continuation (handle->sched, | 363 | GNUNET_SCHEDULER_add_continuation (head->cont, |
369 | head->cont, | ||
370 | head->cont_cls, | 364 | head->cont_cls, |
371 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 365 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
372 | head->cont = NULL; | 366 | head->cont = NULL; |
@@ -527,7 +521,6 @@ service_message_handler (void *cls, | |||
527 | /** | 521 | /** |
528 | * Initialize the connection with the DHT service. | 522 | * Initialize the connection with the DHT service. |
529 | * | 523 | * |
530 | * @param sched scheduler to use | ||
531 | * @param cfg configuration to use | 524 | * @param cfg configuration to use |
532 | * @param ht_len size of the internal hash table to use for | 525 | * @param ht_len size of the internal hash table to use for |
533 | * processing multiple GET/FIND requests in parallel | 526 | * processing multiple GET/FIND requests in parallel |
@@ -535,15 +528,13 @@ service_message_handler (void *cls, | |||
535 | * @return handle to the DHT service, or NULL on error | 528 | * @return handle to the DHT service, or NULL on error |
536 | */ | 529 | */ |
537 | struct GNUNET_DHT_Handle * | 530 | struct GNUNET_DHT_Handle * |
538 | GNUNET_DHT_connect (struct GNUNET_SCHEDULER_Handle *sched, | 531 | GNUNET_DHT_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, |
539 | const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
540 | unsigned int ht_len) | 532 | unsigned int ht_len) |
541 | { | 533 | { |
542 | struct GNUNET_DHT_Handle *handle; | 534 | struct GNUNET_DHT_Handle *handle; |
543 | 535 | ||
544 | handle = GNUNET_malloc (sizeof (struct GNUNET_DHT_Handle)); | 536 | handle = GNUNET_malloc (sizeof (struct GNUNET_DHT_Handle)); |
545 | handle->cfg = cfg; | 537 | handle->cfg = cfg; |
546 | handle->sched = sched; | ||
547 | handle->uid_gen = GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX); | 538 | handle->uid_gen = GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX); |
548 | handle->active_requests = GNUNET_CONTAINER_multihashmap_create (ht_len); | 539 | handle->active_requests = GNUNET_CONTAINER_multihashmap_create (ht_len); |
549 | if (GNUNET_NO == try_connect (handle)) | 540 | if (GNUNET_NO == try_connect (handle)) |
@@ -578,11 +569,9 @@ GNUNET_DHT_disconnect (struct GNUNET_DHT_Handle *handle) | |||
578 | pm); | 569 | pm); |
579 | GNUNET_assert (GNUNET_YES == pm->free_on_send); | 570 | GNUNET_assert (GNUNET_YES == pm->free_on_send); |
580 | if (GNUNET_SCHEDULER_NO_TASK != pm->timeout_task) | 571 | if (GNUNET_SCHEDULER_NO_TASK != pm->timeout_task) |
581 | GNUNET_SCHEDULER_cancel (handle->sched, | 572 | GNUNET_SCHEDULER_cancel (pm->timeout_task); |
582 | pm->timeout_task); | ||
583 | if (NULL != pm->cont) | 573 | if (NULL != pm->cont) |
584 | GNUNET_SCHEDULER_add_continuation (handle->sched, | 574 | GNUNET_SCHEDULER_add_continuation (pm->cont, |
585 | pm->cont, | ||
586 | pm->cont_cls, | 575 | pm->cont_cls, |
587 | GNUNET_SCHEDULER_REASON_TIMEOUT); | 576 | GNUNET_SCHEDULER_REASON_TIMEOUT); |
588 | pm->in_pending_queue = GNUNET_NO; | 577 | pm->in_pending_queue = GNUNET_NO; |
@@ -713,8 +702,7 @@ GNUNET_DHT_route_start (struct GNUNET_DHT_Handle *handle, | |||
713 | { | 702 | { |
714 | route_handle = NULL; | 703 | route_handle = NULL; |
715 | pending->free_on_send = GNUNET_YES; | 704 | pending->free_on_send = GNUNET_YES; |
716 | pending->timeout_task = GNUNET_SCHEDULER_add_delayed (handle->sched, | 705 | pending->timeout_task = GNUNET_SCHEDULER_add_delayed (timeout, |
717 | timeout, | ||
718 | &timeout_route_request, | 706 | &timeout_route_request, |
719 | pending); | 707 | pending); |
720 | } | 708 | } |