gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r19271 - gnunet/src/mesh
Date: Thu, 19 Jan 2012 23:13:41 +0100

Author: bartpolot
Date: 2012-01-19 23:13:40 +0100 (Thu, 19 Jan 2012)
New Revision: 19271

Modified:
   gnunet/src/mesh/mesh_api.c
Log:
Fixed a memory leak on disconnect, double peer_rc decrease on tunnel destroy, 
adjusted backoff, completed doxygen

Modified: gnunet/src/mesh/mesh_api.c
===================================================================
--- gnunet/src/mesh/mesh_api.c  2012-01-19 21:53:15 UTC (rev 19270)
+++ gnunet/src/mesh/mesh_api.c  2012-01-19 22:13:40 UTC (rev 19271)
@@ -267,7 +267,7 @@
   MESH_TunnelNumber tid;
 
     /**
-     * Owner of the tunnel
+     * Owner of the tunnel. 0 if the tunnel is the local client.
      */
   GNUNET_PEER_Id owner;
 
@@ -666,7 +666,7 @@
   {
     GNUNET_SCHEDULER_add_delayed (h->reconnect_time, &reconnect_cbk, h);
     h->reconnect_time =
-        GNUNET_TIME_relative_min (GNUNET_TIME_UNIT_HOURS,
+        GNUNET_TIME_relative_min (GNUNET_TIME_UNIT_SECONDS,
                                   GNUNET_TIME_relative_multiply
                                   (h->reconnect_time, 2));
     LOG (GNUNET_ERROR_TYPE_DEBUG, "mesh:   Next retry in %sms\n",
@@ -1264,6 +1264,7 @@
 {
   struct GNUNET_MESH_Tunnel *t;
   struct GNUNET_MESH_Tunnel *aux;
+  struct GNUNET_MESH_TransmitHandle *th;
 
   t = handle->tunnels_head;
   while (NULL != t)
@@ -1272,6 +1273,20 @@
     destroy_tunnel (t);
     t = aux;
   }
+  while ( (th = handle->th_head) != NULL)
+  {
+    struct GNUNET_MessageHeader *msg;
+
+    /* Make sure it is a connect packet (everything else should have been
+     * already canceled).
+     */
+    GNUNET_break (UINT32_MAX == th->priority);
+    GNUNET_break (NULL == th->notify);
+    msg = (struct GNUNET_MessageHeader *) &th[1];
+    GNUNET_break (GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT == ntohs(msg->type));
+    GNUNET_CONTAINER_DLL_remove (handle->th_head, handle->th_tail, th);
+    GNUNET_free (th);
+  }
   if (NULL != handle->th)
   {
     GNUNET_CLIENT_notify_transmit_ready_cancel (handle->th);
@@ -1331,9 +1346,6 @@
   LOG (GNUNET_ERROR_TYPE_DEBUG, "mesh: Destroying tunnel\n");
   h = tunnel->mesh;
 
-  if (0 != tunnel->owner)
-    GNUNET_PEER_change_rc (tunnel->owner, -1);
-
   msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_DESTROY);
   msg.header.size = htons (sizeof (struct GNUNET_MESH_TunnelMessage));
   msg.tunnel_id = htonl (tunnel->tid);




reply via email to

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