diff options
Diffstat (limited to 'src/peerinfo/peerinfo_api.c')
-rw-r--r-- | src/peerinfo/peerinfo_api.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/src/peerinfo/peerinfo_api.c b/src/peerinfo/peerinfo_api.c index 444ae98e2..4febf2eeb 100644 --- a/src/peerinfo/peerinfo_api.c +++ b/src/peerinfo/peerinfo_api.c | |||
@@ -240,8 +240,9 @@ reconnect (struct GNUNET_PEERINFO_Handle *h) | |||
240 | h->client = GNUNET_CLIENT_connect ("peerinfo", h->cfg); | 240 | h->client = GNUNET_CLIENT_connect ("peerinfo", h->cfg); |
241 | if (NULL == h->client) | 241 | if (NULL == h->client) |
242 | { | 242 | { |
243 | h->r_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, | 243 | h->r_task = |
244 | &reconnect_task, h); | 244 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &reconnect_task, |
245 | h); | ||
245 | return; | 246 | return; |
246 | } | 247 | } |
247 | trigger_transmit (h); | 248 | trigger_transmit (h); |
@@ -283,8 +284,8 @@ do_transmit (void *cls, size_t size, void *buf) | |||
283 | memcpy (buf, &tqe[1], ret); | 284 | memcpy (buf, &tqe[1], ret); |
284 | #if DEBUG_PEERINFO | 285 | #if DEBUG_PEERINFO |
285 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 286 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
286 | "Transmitting request of size %u to `%s' service.\n", | 287 | "Transmitting request of size %u to `%s' service.\n", ret, |
287 | ret, "PEERINFO"); | 288 | "PEERINFO"); |
288 | #endif | 289 | #endif |
289 | GNUNET_CONTAINER_DLL_remove (h->tq_head, h->tq_tail, tqe); | 290 | GNUNET_CONTAINER_DLL_remove (h->tq_head, h->tq_tail, tqe); |
290 | if (tqe->cont != NULL) | 291 | if (tqe->cont != NULL) |
@@ -318,11 +319,11 @@ trigger_transmit (struct GNUNET_PEERINFO_Handle *h) | |||
318 | reconnect (h); | 319 | reconnect (h); |
319 | return; | 320 | return; |
320 | } | 321 | } |
321 | h->th = GNUNET_CLIENT_notify_transmit_ready (h->client, | 322 | h->th = |
322 | tqe->size, | 323 | GNUNET_CLIENT_notify_transmit_ready (h->client, tqe->size, |
323 | GNUNET_TIME_absolute_get_remaining | 324 | GNUNET_TIME_absolute_get_remaining |
324 | (tqe->timeout), GNUNET_YES, | 325 | (tqe->timeout), GNUNET_YES, |
325 | &do_transmit, h); | 326 | &do_transmit, h); |
326 | } | 327 | } |
327 | 328 | ||
328 | 329 | ||
@@ -487,9 +488,8 @@ peerinfo_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
487 | ic->h->in_receive = GNUNET_YES; | 488 | ic->h->in_receive = GNUNET_YES; |
488 | if (ic->callback != NULL) | 489 | if (ic->callback != NULL) |
489 | ic->callback (ic->callback_cls, &im->peer, hello, NULL); | 490 | ic->callback (ic->callback_cls, &im->peer, hello, NULL); |
490 | GNUNET_CLIENT_receive (ic->h->client, | 491 | GNUNET_CLIENT_receive (ic->h->client, &peerinfo_handler, ic, |
491 | &peerinfo_handler, | 492 | GNUNET_TIME_absolute_get_remaining (ic->timeout)); |
492 | ic, GNUNET_TIME_absolute_get_remaining (ic->timeout)); | ||
493 | } | 493 | } |
494 | 494 | ||
495 | 495 | ||
@@ -527,9 +527,8 @@ iterator_start_receive (void *cls, int transmit_success) | |||
527 | ic->h->in_receive = GNUNET_YES; | 527 | ic->h->in_receive = GNUNET_YES; |
528 | ic->in_receive = GNUNET_YES; | 528 | ic->in_receive = GNUNET_YES; |
529 | ic->tqe = NULL; | 529 | ic->tqe = NULL; |
530 | GNUNET_CLIENT_receive (ic->h->client, | 530 | GNUNET_CLIENT_receive (ic->h->client, &peerinfo_handler, ic, |
531 | &peerinfo_handler, | 531 | GNUNET_TIME_absolute_get_remaining (ic->timeout)); |
532 | ic, GNUNET_TIME_absolute_get_remaining (ic->timeout)); | ||
533 | } | 532 | } |
534 | 533 | ||
535 | 534 | ||
@@ -549,8 +548,7 @@ signal_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
549 | GNUNET_CONTAINER_DLL_remove (ic->h->tq_head, ic->h->tq_tail, ic->tqe); | 548 | GNUNET_CONTAINER_DLL_remove (ic->h->tq_head, ic->h->tq_tail, ic->tqe); |
550 | else | 549 | else |
551 | reconnect (ic->h); | 550 | reconnect (ic->h); |
552 | ic->callback (ic->callback_cls, | 551 | ic->callback (ic->callback_cls, NULL, NULL, |
553 | NULL, NULL, | ||
554 | _ | 552 | _ |
555 | ("Timeout transmitting iteration request to `PEERINFO' service.\n")); | 553 | ("Timeout transmitting iteration request to `PEERINFO' service.\n")); |
556 | ic->callback = NULL; | 554 | ic->callback = NULL; |
@@ -592,8 +590,9 @@ GNUNET_PEERINFO_iterate (struct GNUNET_PEERINFO_Handle *h, | |||
592 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 590 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
593 | "Requesting list of peers from PEERINFO service\n"); | 591 | "Requesting list of peers from PEERINFO service\n"); |
594 | #endif | 592 | #endif |
595 | tqe = GNUNET_malloc (sizeof (struct TransmissionQueueEntry) + | 593 | tqe = |
596 | sizeof (struct GNUNET_MessageHeader)); | 594 | GNUNET_malloc (sizeof (struct TransmissionQueueEntry) + |
595 | sizeof (struct GNUNET_MessageHeader)); | ||
597 | tqe->size = sizeof (struct GNUNET_MessageHeader); | 596 | tqe->size = sizeof (struct GNUNET_MessageHeader); |
598 | lapm = (struct GNUNET_MessageHeader *) &tqe[1]; | 597 | lapm = (struct GNUNET_MessageHeader *) &tqe[1]; |
599 | lapm->size = htons (sizeof (struct GNUNET_MessageHeader)); | 598 | lapm->size = htons (sizeof (struct GNUNET_MessageHeader)); |
@@ -606,8 +605,9 @@ GNUNET_PEERINFO_iterate (struct GNUNET_PEERINFO_Handle *h, | |||
606 | "Requesting information on peer `%4s' from PEERINFO service\n", | 605 | "Requesting information on peer `%4s' from PEERINFO service\n", |
607 | GNUNET_i2s (peer)); | 606 | GNUNET_i2s (peer)); |
608 | #endif | 607 | #endif |
609 | tqe = GNUNET_malloc (sizeof (struct TransmissionQueueEntry) + | 608 | tqe = |
610 | sizeof (struct ListPeerMessage)); | 609 | GNUNET_malloc (sizeof (struct TransmissionQueueEntry) + |
610 | sizeof (struct ListPeerMessage)); | ||
611 | tqe->size = sizeof (struct ListPeerMessage); | 611 | tqe->size = sizeof (struct ListPeerMessage); |
612 | lpm = (struct ListPeerMessage *) &tqe[1]; | 612 | lpm = (struct ListPeerMessage *) &tqe[1]; |
613 | lpm->header.size = htons (sizeof (struct ListPeerMessage)); | 613 | lpm->header.size = htons (sizeof (struct ListPeerMessage)); |
@@ -620,8 +620,8 @@ GNUNET_PEERINFO_iterate (struct GNUNET_PEERINFO_Handle *h, | |||
620 | ic->callback = callback; | 620 | ic->callback = callback; |
621 | ic->callback_cls = callback_cls; | 621 | ic->callback_cls = callback_cls; |
622 | ic->timeout = GNUNET_TIME_relative_to_absolute (timeout); | 622 | ic->timeout = GNUNET_TIME_relative_to_absolute (timeout); |
623 | ic->timeout_task = GNUNET_SCHEDULER_add_delayed (timeout, | 623 | ic->timeout_task = |
624 | &signal_timeout, ic); | 624 | GNUNET_SCHEDULER_add_delayed (timeout, &signal_timeout, ic); |
625 | tqe->timeout = ic->timeout; | 625 | tqe->timeout = ic->timeout; |
626 | tqe->cont = &iterator_start_receive; | 626 | tqe->cont = &iterator_start_receive; |
627 | tqe->cont_cls = ic; | 627 | tqe->cont_cls = ic; |