gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r28369 - gnunet/src/mesh


From: gnunet
Subject: [GNUnet-SVN] r28369 - gnunet/src/mesh
Date: Fri, 2 Aug 2013 02:47:19 +0200

Author: bartpolot
Date: 2013-08-02 02:47:19 +0200 (Fri, 02 Aug 2013)
New Revision: 28369

Modified:
   gnunet/src/mesh/gnunet-service-mesh-enc.c
Log:
- channel destroy iterator


Modified: gnunet/src/mesh/gnunet-service-mesh-enc.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh-enc.c   2013-08-02 00:42:06 UTC (rev 
28368)
+++ gnunet/src/mesh/gnunet-service-mesh-enc.c   2013-08-02 00:47:19 UTC (rev 
28369)
@@ -3404,8 +3404,8 @@
 
 
 /**
- * Send a message to all clients in this channel that the channel
- * is no longer valid.
+ * Send a message to all clients (local and remote) of this channel
+ * notifying that the channel is no longer valid.
  *
  * If some peer or client should not receive the message,
  * should be zero'ed out before calling this function.
@@ -3598,6 +3598,7 @@
     channel_rel_free_all (ch->bck_rel);
   }
 
+  GNUNET_CONTAINER_DLL_remove (ch->t->channel_head, ch->t->channel_tail, ch);
   GNUNET_STATISTICS_update (stats, "# channels", -1, GNUNET_NO);
 
   GNUNET_free (ch);
@@ -3657,47 +3658,42 @@
 
 
 /**
- * Iterator for deleting each tunnel whose client endpoint disconnected.
+ * Iterator for deleting each channel whose client endpoint disconnected.
  *
  * @param cls Closure (client that has disconnected).
- * @param key The local tunnel id (used to access the hashmap).
- * @param value The value stored at the key (tunnel to destroy).
+ * @param key The local channel id (used to access the hashmap).
+ * @param value The value stored at the key (channel to destroy).
  *
  * @return GNUNET_OK, keep iterating.
  */
 static int
-tunnel_destroy_iterator (void *cls,
-                         uint32_t key,
-                         void *value)
+channel_destroy_iterator (void *cls,
+                          uint32_t key,
+                          void *value)
 {
-  struct MeshTunnel *t = value;
+  struct MeshChannel *ch = value;
   struct MeshClient *c = cls;
+  struct MeshTunnel2 *t;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              " Tunnel %X / %X destroy, due to client %u shutdown.\n",
-              t->local_tid, t->local_tid_dest, c->id);
-  client_delete_tunnel (c, t);
-  if (c == t->client)
+              " Channel %X / %X destroy, due to client %u shutdown.\n",
+              ch->id, ch->id_dest, c->id);
+
+  if (c == ch->client)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Client %u is destination.\n", 
c->id);
-    t->client = NULL;
-    if (0 != t->next_hop) /* destroy could come before a path is used */
-    {
-      GNUNET_PEER_change_rc (t->next_hop, -1);
-      t->next_hop = 0;
-    }
+    ch->client = NULL;
   }
-  if (c == t->owner)
+  if (c == ch->owner)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Client %u is owner.\n", c->id);
-    t->owner = NULL;
-    if (0 != t->prev_hop) { /* destroy could come before a path is used */
-        GNUNET_PEER_change_rc (t->prev_hop, -1);
-        t->prev_hop = 0;
-    }
+    ch->owner = NULL;
   }
 
-  tunnel_destroy_empty (t);
+  t = ch->t;
+  channel_send_destroy (ch);
+  channel_destroy (ch);
+  tunnel_destroy_if_empty (t);
 
   return GNUNET_OK;
 }




reply via email to

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