aboutsummaryrefslogtreecommitdiff
path: root/src/peerinfo
diff options
context:
space:
mode:
Diffstat (limited to 'src/peerinfo')
-rw-r--r--src/peerinfo/peerinfo_api.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/peerinfo/peerinfo_api.c b/src/peerinfo/peerinfo_api.c
index c13224e83f..62e20b266a 100644
--- a/src/peerinfo/peerinfo_api.c
+++ b/src/peerinfo/peerinfo_api.c
@@ -186,7 +186,7 @@ struct GNUNET_PEERINFO_Handle
* Set to GNUNET_YES if we are currently receiving replies from the
* service.
*/
- int in_receive;
+ int request_transmitted;
};
@@ -227,8 +227,8 @@ GNUNET_PEERINFO_disconnect (struct GNUNET_PEERINFO_Handle *h)
while (NULL != (ic = h->ic_head))
{
- GNUNET_break (GNUNET_YES == ic->in_receive);
- ic->in_receive = GNUNET_NO;
+ GNUNET_break (GNUNET_YES == ic->request_transmitted);
+ ic->request_transmitted = GNUNET_NO;
GNUNET_PEERINFO_iterate_cancel (ic);
}
while (NULL != (ac = h->ac_head))
@@ -492,7 +492,7 @@ peerinfo_handler (void *cls, const struct GNUNET_MessageHeader *msg)
GNUNET_assert (NULL != ic);
h->in_receive = GNUNET_NO;
- ic->in_receive = GNUNET_NO;
+ ic->request_transmitted = GNUNET_NO;
cb = ic->callback;
cb_cls = ic->callback_cls;
if (NULL == msg)
@@ -513,6 +513,12 @@ peerinfo_handler (void *cls, const struct GNUNET_MessageHeader *msg)
"Received end of list of peers from `%s' service\n", "PEERINFO");
GNUNET_PEERINFO_iterate_cancel (ic);
trigger_transmit (h);
+ if (GNUNET_NO == h->in_receive)
+ {
+ h->in_receive = GNUNET_YES;
+ GNUNET_CLIENT_receive (h->client, &peerinfo_handler, h,
+ GNUNET_TIME_absolute_get_remaining (ic->timeout));
+ }
if (NULL != cb)
cb (cb_cls, NULL, NULL, NULL);
return;
@@ -594,8 +600,8 @@ peerinfo_handler (void *cls, const struct GNUNET_MessageHeader *msg)
"Received %u bytes of `%s' information about peer `%s' from `%s' service\n",
(hello == NULL) ? 0 : (unsigned int) GNUNET_HELLO_size (hello), "HELLO",
GNUNET_i2s (&im->peer), "PEERINFO");
+ ic->request_transmitted = GNUNET_YES;
h->in_receive = GNUNET_YES;
- ic->in_receive = GNUNET_YES;
GNUNET_CLIENT_receive (h->client, &peerinfo_handler, h,
GNUNET_TIME_absolute_get_remaining (ic->timeout));
if (NULL != cb)
@@ -631,7 +637,7 @@ iterator_start_receive (void *cls, const char *emsg)
}
LOG (GNUNET_ERROR_TYPE_DEBUG, "Waiting for response from `%s' service.\n",
"PEERINFO");
- ic->in_receive = GNUNET_YES;
+ ic->request_transmitted = GNUNET_YES;
if (GNUNET_NO == h->in_receive)
{
h->in_receive = GNUNET_YES;
@@ -755,7 +761,7 @@ GNUNET_PEERINFO_iterate_cancel (struct GNUNET_PEERINFO_IteratorContext *ic)
ic->timeout_task = GNUNET_SCHEDULER_NO_TASK;
}
ic->callback = NULL;
- if (GNUNET_YES == ic->in_receive)
+ if (GNUNET_YES == ic->request_transmitted)
return; /* need to finish processing */
GNUNET_CONTAINER_DLL_remove (h->ic_head,
h->ic_tail,