X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fpeerinfo%2Fpeerinfo_api.c;h=28828f3a3f1be3680f59dfcbfc86538c6895eca9;hb=a5d0694571db763efd0787a680168492f325b2e6;hp=444ae98e26b7c341374a8b8b50413aac8257d030;hpb=502af2167f7c218366666ca4944bd7cc54b5b19a;p=oweals%2Fgnunet.git diff --git a/src/peerinfo/peerinfo_api.c b/src/peerinfo/peerinfo_api.c index 444ae98e2..28828f3a3 100644 --- a/src/peerinfo/peerinfo_api.c +++ b/src/peerinfo/peerinfo_api.c @@ -33,7 +33,7 @@ /** * Function to call after transmission has succeeded. - * + * * @param cls closure * @param success GNUNET_OK if transmission worked, GNUNET_SYSERR on error */ @@ -188,7 +188,8 @@ GNUNET_PEERINFO_disconnect (struct GNUNET_PEERINFO_Handle *h) * * @param h handle to the service */ -static void trigger_transmit (struct GNUNET_PEERINFO_Handle *h); +static void +trigger_transmit (struct GNUNET_PEERINFO_Handle *h); /** @@ -196,13 +197,14 @@ static void trigger_transmit (struct GNUNET_PEERINFO_Handle *h); * * @param h handle to the service */ -static void reconnect (struct GNUNET_PEERINFO_Handle *h); +static void +reconnect (struct GNUNET_PEERINFO_Handle *h); /** * Task scheduled to re-try connecting to the peerinfo service. * * @param cls the 'struct GNUNET_PEERINFO_Handle' - * @param ts scheduler context + * @param tc scheduler context */ static void reconnect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) @@ -240,8 +242,9 @@ reconnect (struct GNUNET_PEERINFO_Handle *h) h->client = GNUNET_CLIENT_connect ("peerinfo", h->cfg); if (NULL == h->client) { - h->r_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, - &reconnect_task, h); + h->r_task = + GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &reconnect_task, + h); return; } trigger_transmit (h); @@ -283,8 +286,8 @@ do_transmit (void *cls, size_t size, void *buf) memcpy (buf, &tqe[1], ret); #if DEBUG_PEERINFO GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Transmitting request of size %u to `%s' service.\n", - ret, "PEERINFO"); + "Transmitting request of size %u to `%s' service.\n", ret, + "PEERINFO"); #endif GNUNET_CONTAINER_DLL_remove (h->tq_head, h->tq_tail, tqe); if (tqe->cont != NULL) @@ -318,16 +321,16 @@ trigger_transmit (struct GNUNET_PEERINFO_Handle *h) reconnect (h); return; } - h->th = GNUNET_CLIENT_notify_transmit_ready (h->client, - tqe->size, - GNUNET_TIME_absolute_get_remaining - (tqe->timeout), GNUNET_YES, - &do_transmit, h); + h->th = + GNUNET_CLIENT_notify_transmit_ready (h->client, tqe->size, + GNUNET_TIME_absolute_get_remaining + (tqe->timeout), GNUNET_YES, + &do_transmit, h); } /** - * Add a host to the persistent list. This method operates in + * Add a host to the persistent list. This method operates in * semi-reliable mode: if the transmission is not completed by * the time 'GNUNET_PEERINFO_disconnect' is called, it will be * aborted. Furthermore, if a second HELLO is added for the @@ -487,9 +490,8 @@ peerinfo_handler (void *cls, const struct GNUNET_MessageHeader *msg) ic->h->in_receive = GNUNET_YES; if (ic->callback != NULL) ic->callback (ic->callback_cls, &im->peer, hello, NULL); - GNUNET_CLIENT_receive (ic->h->client, - &peerinfo_handler, - ic, GNUNET_TIME_absolute_get_remaining (ic->timeout)); + GNUNET_CLIENT_receive (ic->h->client, &peerinfo_handler, ic, + GNUNET_TIME_absolute_get_remaining (ic->timeout)); } @@ -527,14 +529,13 @@ iterator_start_receive (void *cls, int transmit_success) ic->h->in_receive = GNUNET_YES; ic->in_receive = GNUNET_YES; ic->tqe = NULL; - GNUNET_CLIENT_receive (ic->h->client, - &peerinfo_handler, - ic, GNUNET_TIME_absolute_get_remaining (ic->timeout)); + GNUNET_CLIENT_receive (ic->h->client, &peerinfo_handler, ic, + GNUNET_TIME_absolute_get_remaining (ic->timeout)); } /** - * Peerinfo iteration request has timed out. + * Peerinfo iteration request has timed out. * * @param cls the 'struct GNUNET_PEERINFO_IteratorContext*' * @param tc scheduler context @@ -549,8 +550,7 @@ signal_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_CONTAINER_DLL_remove (ic->h->tq_head, ic->h->tq_tail, ic->tqe); else reconnect (ic->h); - ic->callback (ic->callback_cls, - NULL, NULL, + ic->callback (ic->callback_cls, NULL, NULL, _ ("Timeout transmitting iteration request to `PEERINFO' service.\n")); ic->callback = NULL; @@ -567,7 +567,7 @@ signal_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * * Instead of calling this function with 'peer == NULL' it is often * better to use 'GNUNET_PEERINFO_notify'. - * + * * @param h handle to the peerinfo service * @param peer restrict iteration to this peer only (can be NULL) * @param timeout how long to wait until timing out @@ -592,8 +592,9 @@ GNUNET_PEERINFO_iterate (struct GNUNET_PEERINFO_Handle *h, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Requesting list of peers from PEERINFO service\n"); #endif - tqe = GNUNET_malloc (sizeof (struct TransmissionQueueEntry) + - sizeof (struct GNUNET_MessageHeader)); + tqe = + GNUNET_malloc (sizeof (struct TransmissionQueueEntry) + + sizeof (struct GNUNET_MessageHeader)); tqe->size = sizeof (struct GNUNET_MessageHeader); lapm = (struct GNUNET_MessageHeader *) &tqe[1]; lapm->size = htons (sizeof (struct GNUNET_MessageHeader)); @@ -606,8 +607,9 @@ GNUNET_PEERINFO_iterate (struct GNUNET_PEERINFO_Handle *h, "Requesting information on peer `%4s' from PEERINFO service\n", GNUNET_i2s (peer)); #endif - tqe = GNUNET_malloc (sizeof (struct TransmissionQueueEntry) + - sizeof (struct ListPeerMessage)); + tqe = + GNUNET_malloc (sizeof (struct TransmissionQueueEntry) + + sizeof (struct ListPeerMessage)); tqe->size = sizeof (struct ListPeerMessage); lpm = (struct ListPeerMessage *) &tqe[1]; lpm->header.size = htons (sizeof (struct ListPeerMessage)); @@ -620,8 +622,8 @@ GNUNET_PEERINFO_iterate (struct GNUNET_PEERINFO_Handle *h, ic->callback = callback; ic->callback_cls = callback_cls; ic->timeout = GNUNET_TIME_relative_to_absolute (timeout); - ic->timeout_task = GNUNET_SCHEDULER_add_delayed (timeout, - &signal_timeout, ic); + ic->timeout_task = + GNUNET_SCHEDULER_add_delayed (timeout, &signal_timeout, ic); tqe->timeout = ic->timeout; tqe->cont = &iterator_start_receive; tqe->cont_cls = ic;