aboutsummaryrefslogtreecommitdiff
path: root/src/peerinfo/peerinfo_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-06-09 14:32:48 +0000
committerChristian Grothoff <christian@grothoff.org>2012-06-09 14:32:48 +0000
commit349c0fd96682b87bce270696805903ad13c6faea (patch)
treed049dbc2ec56dfd9a1280faddac342dd73fda5ea /src/peerinfo/peerinfo_api.c
parentf565b4891b9303d7c6c8b15c8966239793ed4ead (diff)
downloadgnunet-349c0fd96682b87bce270696805903ad13c6faea.tar.gz
gnunet-349c0fd96682b87bce270696805903ad13c6faea.zip
-handle disconnect error on shutdown better
Diffstat (limited to 'src/peerinfo/peerinfo_api.c')
-rw-r--r--src/peerinfo/peerinfo_api.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/peerinfo/peerinfo_api.c b/src/peerinfo/peerinfo_api.c
index 74c1e49a9..f7cff1bed 100644
--- a/src/peerinfo/peerinfo_api.c
+++ b/src/peerinfo/peerinfo_api.c
@@ -489,14 +489,29 @@ peerinfo_handler (void *cls, const struct GNUNET_MessageHeader *msg)
489 void *cb_cls; 489 void *cb_cls;
490 uint16_t ms; 490 uint16_t ms;
491 491
492 GNUNET_assert (NULL != ic);
493 h->in_receive = GNUNET_NO; 492 h->in_receive = GNUNET_NO;
494 ic->request_transmitted = GNUNET_NO;
495 cb = ic->callback;
496 cb_cls = ic->callback_cls;
497 if (NULL == msg) 493 if (NULL == msg)
498 { 494 {
499 /* peerinfo service died, signal error */ 495 /* peerinfo service died, signal error */
496 if (NULL != ic)
497 {
498 cb = ic->callback;
499 cb_cls = ic->callback_cls;
500 GNUNET_PEERINFO_iterate_cancel (ic);
501 }
502 else
503 {
504 cb = NULL;
505 }
506 reconnect (h);
507 if (NULL != cb)
508 cb (cb_cls, NULL, NULL,
509 _("Failed to receive response from `PEERINFO' service."));
510 return;
511 }
512 if (NULL == ic)
513 {
514 /* didn't expect a response, reconnect */
500 GNUNET_PEERINFO_iterate_cancel (ic); 515 GNUNET_PEERINFO_iterate_cancel (ic);
501 reconnect (h); 516 reconnect (h);
502 if (NULL != cb) 517 if (NULL != cb)
@@ -504,7 +519,9 @@ peerinfo_handler (void *cls, const struct GNUNET_MessageHeader *msg)
504 _("Failed to receive response from `PEERINFO' service.")); 519 _("Failed to receive response from `PEERINFO' service."));
505 return; 520 return;
506 } 521 }
507 522 ic->request_transmitted = GNUNET_NO;
523 cb = ic->callback;
524 cb_cls = ic->callback_cls;
508 if (GNUNET_MESSAGE_TYPE_PEERINFO_INFO_END == ntohs (msg->type)) 525 if (GNUNET_MESSAGE_TYPE_PEERINFO_INFO_END == ntohs (msg->type))
509 { 526 {
510 /* normal end of list of peers, signal end, process next pending request */ 527 /* normal end of list of peers, signal end, process next pending request */