gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r30980 - gnunet/src/fs


From: gnunet
Subject: [GNUnet-SVN] r30980 - gnunet/src/fs
Date: Fri, 29 Nov 2013 18:22:08 +0100

Author: grothoff
Date: 2013-11-29 18:22:08 +0100 (Fri, 29 Nov 2013)
New Revision: 30980

Modified:
   gnunet/src/fs/gnunet-service-fs_mesh_client.c
   gnunet/src/fs/gnunet-service-fs_pr.c
Log:
-fix #3133

Modified: gnunet/src/fs/gnunet-service-fs_mesh_client.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_mesh_client.c       2013-11-29 16:34:39 UTC 
(rev 30979)
+++ gnunet/src/fs/gnunet-service-fs_mesh_client.c       2013-11-29 17:22:08 UTC 
(rev 30980)
@@ -368,7 +368,7 @@
 
 
 /**
- * Closure for 'handle_reply'.
+ * Closure for handle_reply().
  */
 struct HandleReplyClosure
 {
@@ -677,6 +677,14 @@
   mh->channel = NULL;
   while (NULL != (sr = mh->pending_head))
     GSF_mesh_query_cancel (sr);
+  /* first remove `mh` from the `mesh_map`, so that if the
+     callback from `free_waiting_entry()` happens to re-issue
+     the request, we don't immediately have it back in the
+     `waiting_map`. */
+  GNUNET_assert (GNUNET_OK ==
+                GNUNET_CONTAINER_multipeermap_remove (mesh_map,
+                                                      &mh->target,
+                                                      mh));
   GNUNET_CONTAINER_multihashmap_iterate (mh->waiting_map,
                                         &free_waiting_entry,
                                         mh);
@@ -686,10 +694,8 @@
     GNUNET_SCHEDULER_cancel (mh->timeout_task);
   if (GNUNET_SCHEDULER_NO_TASK != mh->reset_task)
     GNUNET_SCHEDULER_cancel (mh->reset_task);
-  GNUNET_assert (GNUNET_OK ==
-                GNUNET_CONTAINER_multipeermap_remove (mesh_map,
-                                                      &mh->target,
-                                                      mh));
+  GNUNET_assert (0 ==
+                 GNUNET_CONTAINER_multihashmap_size (mh->waiting_map));
   GNUNET_CONTAINER_multihashmap_destroy (mh->waiting_map);
   GNUNET_free (mh);
 }

Modified: gnunet/src/fs/gnunet-service-fs_pr.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_pr.c        2013-11-29 16:34:39 UTC (rev 
30979)
+++ gnunet/src/fs/gnunet-service-fs_pr.c        2013-11-29 17:22:08 UTC (rev 
30980)
@@ -719,10 +719,8 @@
 }
 
 
-
-
 /**
- * Closure for "process_reply" function.
+ * Closure for process_reply() function.
  */
 struct ProcessReplyClosure
 {
@@ -800,7 +798,9 @@
  * @return #GNUNET_YES (we should continue to iterate)
  */
 static int
-process_reply (void *cls, const struct GNUNET_HashCode * key, void *value)
+process_reply (void *cls,
+               const struct GNUNET_HashCode *key,
+               void *value)
 {
   struct ProcessReplyClosure *prq = cls;
   struct GSF_PendingRequest *pr = value;
@@ -1151,10 +1151,10 @@
  */
 static void
 mesh_reply_proc (void *cls,
-                  enum GNUNET_BLOCK_Type type,
-                  struct GNUNET_TIME_Absolute expiration,
-                  size_t data_size,
-                  const void *data)
+                 enum GNUNET_BLOCK_Type type,
+                 struct GNUNET_TIME_Absolute expiration,
+                 size_t data_size,
+                 const void *data)
 {
   struct GSF_PendingRequest *pr = cls;
   struct ProcessReplyClosure prq;
@@ -1173,10 +1173,10 @@
     /* retry -- without delay, as this is non-anonymous
        and mesh/mesh connect will take some time anyway */
     pr->mesh_request = GSF_mesh_query (pr->public_data.target,
-                                          &pr->public_data.query,
-                                          pr->public_data.type,
-                                          &mesh_reply_proc,
-                                          pr);
+                                       &pr->public_data.query,
+                                       pr->public_data.type,
+                                       &mesh_reply_proc,
+                                       pr);
     return;
   }
   if (GNUNET_YES !=




reply via email to

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