gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r28263 - gnunet/src/mesh
Date: Tue, 23 Jul 2013 14:51:47 +0200

Author: bartpolot
Date: 2013-07-23 14:51:47 +0200 (Tue, 23 Jul 2013)
New Revision: 28263

Modified:
   gnunet/src/mesh/gnunet-service-mesh.c
Log:
- don't leak memory on repeated PATH_CREATE

Modified: gnunet/src/mesh/gnunet-service-mesh.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh.c       2013-07-23 05:38:37 UTC (rev 
28262)
+++ gnunet/src/mesh/gnunet-service-mesh.c       2013-07-23 12:51:47 UTC (rev 
28263)
@@ -4044,23 +4044,27 @@
 
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "  It's for us!\n");
     peer_info_add_path_to_origin (orig_peer_info, path, GNUNET_YES);
+    /* This can be a retransmission due to a lost PATH ACK.
+     * Check if we already have a destination client for the tunnel. */
+    if (t->client != c)
+    {
+      /* Assign local tid */
+      while (NULL != tunnel_get_incoming (next_local_tid))
+        next_local_tid = (next_local_tid + 1) | 
GNUNET_MESH_LOCAL_TUNNEL_ID_SERV;
+      t->local_tid_dest = next_local_tid++;
+      next_local_tid = next_local_tid | GNUNET_MESH_LOCAL_TUNNEL_ID_SERV;
 
-    /* Assign local tid */
-    while (NULL != tunnel_get_incoming (next_local_tid))
-      next_local_tid = (next_local_tid + 1) | GNUNET_MESH_LOCAL_TUNNEL_ID_SERV;
-    t->local_tid_dest = next_local_tid++;
-    next_local_tid = next_local_tid | GNUNET_MESH_LOCAL_TUNNEL_ID_SERV;
+      if (GNUNET_YES == t->reliable)
+      {
+        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! Reliable\n");
+        t->bck_rel = GNUNET_malloc (sizeof (struct MeshTunnelReliability));
+        t->bck_rel->t = t;
+        t->bck_rel->expected_delay = MESH_RETRANSMIT_TIME;
+      }
 
-    if (GNUNET_YES == t->reliable)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! Reliable\n");
-      t->bck_rel = GNUNET_malloc (sizeof (struct MeshTunnelReliability));
-      t->bck_rel->t = t;
-      t->bck_rel->expected_delay = MESH_RETRANSMIT_TIME;
+      tunnel_add_client (t, c);
+      send_local_tunnel_create (t);
     }
-
-    tunnel_add_client (t, c);
-    send_local_tunnel_create (t);
     send_path_ack (t);
      /* Eliminate tunnel when origin dies */
     tunnel_reset_timeout (t, GNUNET_YES);




reply via email to

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