gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r27384 - gnunet/src/mesh
Date: Fri, 7 Jun 2013 03:46:47 +0200

Author: bartpolot
Date: 2013-06-07 03:46:47 +0200 (Fri, 07 Jun 2013)
New Revision: 27384

Modified:
   gnunet/src/mesh/gnunet-service-mesh-new.c
Log:
- fix memleak

Modified: gnunet/src/mesh/gnunet-service-mesh-new.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh-new.c   2013-06-07 01:35:33 UTC (rev 
27383)
+++ gnunet/src/mesh/gnunet-service-mesh-new.c   2013-06-07 01:46:47 UTC (rev 
27384)
@@ -1500,7 +1500,31 @@
 }
 
 
+
 /**
+ * Remove a tunnel from the list of tunnels a peer participates in.
+ * 
+ * @param p Peer to clean.
+ * @param t Tunnel to remove.
+ */
+static void
+peer_info_remove_tunnel (struct MeshPeerInfo *p, struct MeshTunnel *t)
+{
+  unsigned int i;
+
+  for (i = 0; i < p->ntunnels; i++)
+  {
+    if (p->tunnels[i] == t)
+    {
+      p->tunnels[i] = p->tunnels[p->ntunnels - 1];
+      GNUNET_array_grow (p->tunnels, p->ntunnels, p->ntunnels - 1);
+      return;
+    }
+  }
+}
+
+
+/**
  * Function called if the connection to the peer has been stalled for a while,
  * possibly due to a missed ACK. Poll the peer about its ACK status.
  *
@@ -2401,9 +2425,12 @@
   }
   else if (c == t->owner)
   {
+    struct MeshPeerInfo *p;
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Client %u is owner.\n", c->id);
     t->owner = NULL;
     t->prev_hop = 0;
+    p = peer_get_short(t->dest);
+    peer_info_remove_tunnel (p, t);
   }
   else
   {




reply via email to

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