gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r21814 - gnunet/src/peerinfo


From: gnunet
Subject: [GNUnet-SVN] r21814 - gnunet/src/peerinfo
Date: Sat, 9 Jun 2012 16:32:48 +0200

Author: grothoff
Date: 2012-06-09 16:32:48 +0200 (Sat, 09 Jun 2012)
New Revision: 21814

Modified:
   gnunet/src/peerinfo/peerinfo_api.c
Log:
-handle disconnect error on shutdown better

Modified: gnunet/src/peerinfo/peerinfo_api.c
===================================================================
--- gnunet/src/peerinfo/peerinfo_api.c  2012-06-09 14:27:11 UTC (rev 21813)
+++ gnunet/src/peerinfo/peerinfo_api.c  2012-06-09 14:32:48 UTC (rev 21814)
@@ -489,14 +489,29 @@
   void *cb_cls;
   uint16_t ms;
 
-  GNUNET_assert (NULL != ic);
   h->in_receive = GNUNET_NO;
-  ic->request_transmitted = GNUNET_NO;
-  cb = ic->callback;
-  cb_cls = ic->callback_cls;
   if (NULL == msg)
   {
     /* peerinfo service died, signal error */
+    if (NULL != ic)
+    {
+      cb = ic->callback;
+      cb_cls = ic->callback_cls;
+      GNUNET_PEERINFO_iterate_cancel (ic);
+    }
+    else
+    {
+      cb = NULL;
+    }
+    reconnect (h);
+    if (NULL != cb)
+      cb (cb_cls, NULL, NULL,
+         _("Failed to receive response from `PEERINFO' service."));
+    return;
+  }
+  if (NULL == ic)
+  {
+    /* didn't expect a response, reconnect */
     GNUNET_PEERINFO_iterate_cancel (ic);
     reconnect (h);
     if (NULL != cb)
@@ -504,7 +519,9 @@
          _("Failed to receive response from `PEERINFO' service."));
     return;
   }
-
+  ic->request_transmitted = GNUNET_NO;
+  cb = ic->callback;
+  cb_cls = ic->callback_cls;
   if (GNUNET_MESSAGE_TYPE_PEERINFO_INFO_END == ntohs (msg->type))
   {
     /* normal end of list of peers, signal end, process next pending request */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]