gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r34687 - gnunet/src/peerstore


From: gnunet
Subject: [GNUnet-SVN] r34687 - gnunet/src/peerstore
Date: Fri, 19 Dec 2014 03:06:13 +0100

Author: otarabai
Date: 2014-12-19 03:06:13 +0100 (Fri, 19 Dec 2014)
New Revision: 34687

Modified:
   gnunet/src/peerstore/peerstore_api.c
Log:
#3581


Modified: gnunet/src/peerstore/peerstore_api.c
===================================================================
--- gnunet/src/peerstore/peerstore_api.c        2014-12-18 21:39:33 UTC (rev 
34686)
+++ gnunet/src/peerstore/peerstore_api.c        2014-12-19 02:06:13 UTC (rev 
34687)
@@ -437,6 +437,7 @@
 reconnect (struct GNUNET_PEERSTORE_Handle *h)
 {
   struct GNUNET_PEERSTORE_IterateContext *ic;
+  struct GNUNET_PEERSTORE_IterateContext *ic_tmp;
   GNUNET_PEERSTORE_Processor icb;
   void *icb_cls;
   struct GNUNET_PEERSTORE_StoreContext *sc;
@@ -450,32 +451,17 @@
       sc->ev = NULL;
     }
   }
-  if (NULL != h->mq)
+  ic = h->iterate_head;
+  while (NULL != ic)
   {
-    GNUNET_MQ_destroy (h->mq);
-    h->mq = NULL;
-  }
-  if (NULL != h->client)
-  {
-    GNUNET_CLIENT_disconnect (h->client);
-    h->client = NULL;
-  }
-  h->client = GNUNET_CLIENT_connect ("peerstore", h->cfg);
-  GNUNET_assert (NULL != h->client);
-  h->mq =
-      GNUNET_MQ_queue_for_connection_client (h->client, mq_handlers,
-                                             &handle_client_error, h);
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Resending pending requests after reconnect.\n");
-  if (NULL != h->watches)
-    GNUNET_CONTAINER_multihashmap_iterate (h->watches, &rewatch_it, h);
-  for (ic = h->iterate_head; NULL != ic; ic = ic->next)
-  {
     if (GNUNET_YES == ic->iterating)
     {
       icb = ic->callback;
       icb_cls = ic->callback_cls;
-      GNUNET_PEERSTORE_iterate_cancel (ic);
+      ic->iterating = GNUNET_NO;
+      ic_tmp = ic;
+      ic = ic->next;
+      GNUNET_PEERSTORE_iterate_cancel (ic_tmp);
       if (NULL != icb)
         icb (icb_cls, NULL, _("Iteration canceled due to reconnection."));
     }
@@ -491,16 +477,39 @@
         GNUNET_MQ_send_cancel (ic->ev);
         ic->ev = NULL;
       }
-      ic->ev =
-          PEERSTORE_create_record_mq_envelope (ic->sub_system, &ic->peer,
-                                               ic->key, NULL, 0, NULL, 0,
-                                               
GNUNET_MESSAGE_TYPE_PEERSTORE_ITERATE);
-      GNUNET_MQ_notify_sent (ic->ev, &iterate_request_sent, ic);
-      GNUNET_MQ_send (h->mq, ic->ev);
-      ic->timeout_task =
-          GNUNET_SCHEDULER_add_delayed (ic->timeout, &iterate_timeout, ic);
+      ic = ic->next;
     }
   }
+  if (NULL != h->mq)
+  {
+    GNUNET_MQ_destroy (h->mq);
+    h->mq = NULL;
+  }
+  if (NULL != h->client)
+  {
+    GNUNET_CLIENT_disconnect (h->client);
+    h->client = NULL;
+  }
+  h->client = GNUNET_CLIENT_connect ("peerstore", h->cfg);
+  GNUNET_assert (NULL != h->client);
+  h->mq =
+      GNUNET_MQ_queue_for_connection_client (h->client, mq_handlers,
+                                             &handle_client_error, h);
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Resending pending requests after reconnect.\n");
+  if (NULL != h->watches)
+    GNUNET_CONTAINER_multihashmap_iterate (h->watches, &rewatch_it, h);
+  for (ic = h->iterate_head; NULL != ic; ic = ic->next)
+  {
+    ic->ev =
+        PEERSTORE_create_record_mq_envelope (ic->sub_system, &ic->peer, 
ic->key,
+                                             NULL, 0, NULL, 0,
+                                             
GNUNET_MESSAGE_TYPE_PEERSTORE_ITERATE);
+    GNUNET_MQ_notify_sent (ic->ev, &iterate_request_sent, ic);
+    GNUNET_MQ_send (h->mq, ic->ev);
+    ic->timeout_task =
+        GNUNET_SCHEDULER_add_delayed (ic->timeout, &iterate_timeout, ic);
+  }
   for (sc = h->store_head; NULL != sc; sc = sc->next)
   {
     sc->ev =




reply via email to

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