gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r30798 - gnunet/src/fs
Date: Tue, 19 Nov 2013 15:24:51 +0100

Author: grothoff
Date: 2013-11-19 15:24:51 +0100 (Tue, 19 Nov 2013)
New Revision: 30798

Modified:
   gnunet/src/fs/gnunet-service-fs_mesh_client.c
Log:
-fixing crash from reset_mesh due to mesh API semantic change: cleaner is now 
always called, but we don't want it to release the maps in this case

Modified: gnunet/src/fs/gnunet-service-fs_mesh_client.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_mesh_client.c       2013-11-19 14:06:32 UTC 
(rev 30797)
+++ gnunet/src/fs/gnunet-service-fs_mesh_client.c       2013-11-19 14:24:51 UTC 
(rev 30798)
@@ -213,10 +213,13 @@
 static void
 reset_mesh (struct MeshHandle *mh)
 {
+  const struct GNUNET_MESH_Channel *channel = mh->channel;
+
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "Resetting mesh channel to %s\n",
              GNUNET_i2s (&mh->target));
-  GNUNET_MESH_channel_destroy (mh->channel);
+  mh->channel = NULL;
+  GNUNET_MESH_channel_destroy (channel);
   GNUNET_CONTAINER_multihashmap_iterate (mh->waiting_map,
                                         &move_to_pending,
                                         mh);
@@ -342,8 +345,8 @@
   transmit_pending (mh);
   return sizeof (sqm);
 }
-       
 
+
 /**
  * Transmit pending requests via the mesh.
  *
@@ -641,7 +644,7 @@
  *
  * @param cls NULL
  * @param channel channel of the disconnecting client
- * @param channel_ctx our 'struct MeshClient'
+ * @param channel_ctx our `struct MeshClient`
  */
 static void
 cleaner_cb (void *cls,
@@ -651,6 +654,9 @@
   struct MeshHandle *mh = channel_ctx;
   struct GSF_MeshRequest *sr;
 
+  if (NULL == mh->channel)
+    return; /* being destroyed elsewhere */
+  GNUNET_assert (channel == mh->channel);
   mh->channel = NULL;
   while (NULL != (sr = mh->pending_head))
   {
@@ -703,8 +709,8 @@
  *
  * @param cls NULL
  * @param key target peer, unused
- * @param value the 'struct MeshHandle' to destroy
- * @return GNUNET_YES (continue to iterate)
+ * @param value the `struct MeshHandle` to destroy
+ * @return #GNUNET_YES (continue to iterate)
  */
 static int
 release_meshs (void *cls,




reply via email to

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