aboutsummaryrefslogtreecommitdiff
path: root/src/mesh
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2012-01-19 22:13:40 +0000
committerBart Polot <bart@net.in.tum.de>2012-01-19 22:13:40 +0000
commitef93f11e7c3e325e66d2644b989fc9b7b1cc2af6 (patch)
treec95063716b9fe549d986c9f807c8d9a5595b34c7 /src/mesh
parent1f74c14aa117afe2395e3ab0d7e53498504d0bc3 (diff)
downloadgnunet-ef93f11e7c3e325e66d2644b989fc9b7b1cc2af6.tar.gz
gnunet-ef93f11e7c3e325e66d2644b989fc9b7b1cc2af6.zip
Fixed a memory leak on disconnect, double peer_rc decrease on tunnel destroy, adjusted backoff, completed doxygen
Diffstat (limited to 'src/mesh')
-rw-r--r--src/mesh/mesh_api.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/mesh/mesh_api.c b/src/mesh/mesh_api.c
index c0b9a2a85..02811a502 100644
--- a/src/mesh/mesh_api.c
+++ b/src/mesh/mesh_api.c
@@ -267,7 +267,7 @@ struct GNUNET_MESH_Tunnel
267 MESH_TunnelNumber tid; 267 MESH_TunnelNumber tid;
268 268
269 /** 269 /**
270 * Owner of the tunnel 270 * Owner of the tunnel. 0 if the tunnel is the local client.
271 */ 271 */
272 GNUNET_PEER_Id owner; 272 GNUNET_PEER_Id owner;
273 273
@@ -666,7 +666,7 @@ reconnect (struct GNUNET_MESH_Handle *h)
666 { 666 {
667 GNUNET_SCHEDULER_add_delayed (h->reconnect_time, &reconnect_cbk, h); 667 GNUNET_SCHEDULER_add_delayed (h->reconnect_time, &reconnect_cbk, h);
668 h->reconnect_time = 668 h->reconnect_time =
669 GNUNET_TIME_relative_min (GNUNET_TIME_UNIT_HOURS, 669 GNUNET_TIME_relative_min (GNUNET_TIME_UNIT_SECONDS,
670 GNUNET_TIME_relative_multiply 670 GNUNET_TIME_relative_multiply
671 (h->reconnect_time, 2)); 671 (h->reconnect_time, 2));
672 LOG (GNUNET_ERROR_TYPE_DEBUG, "mesh: Next retry in %sms\n", 672 LOG (GNUNET_ERROR_TYPE_DEBUG, "mesh: Next retry in %sms\n",
@@ -1264,6 +1264,7 @@ GNUNET_MESH_disconnect (struct GNUNET_MESH_Handle *handle)
1264{ 1264{
1265 struct GNUNET_MESH_Tunnel *t; 1265 struct GNUNET_MESH_Tunnel *t;
1266 struct GNUNET_MESH_Tunnel *aux; 1266 struct GNUNET_MESH_Tunnel *aux;
1267 struct GNUNET_MESH_TransmitHandle *th;
1267 1268
1268 t = handle->tunnels_head; 1269 t = handle->tunnels_head;
1269 while (NULL != t) 1270 while (NULL != t)
@@ -1272,6 +1273,20 @@ GNUNET_MESH_disconnect (struct GNUNET_MESH_Handle *handle)
1272 destroy_tunnel (t); 1273 destroy_tunnel (t);
1273 t = aux; 1274 t = aux;
1274 } 1275 }
1276 while ( (th = handle->th_head) != NULL)
1277 {
1278 struct GNUNET_MessageHeader *msg;
1279
1280 /* Make sure it is a connect packet (everything else should have been
1281 * already canceled).
1282 */
1283 GNUNET_break (UINT32_MAX == th->priority);
1284 GNUNET_break (NULL == th->notify);
1285 msg = (struct GNUNET_MessageHeader *) &th[1];
1286 GNUNET_break (GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT == ntohs(msg->type));
1287 GNUNET_CONTAINER_DLL_remove (handle->th_head, handle->th_tail, th);
1288 GNUNET_free (th);
1289 }
1275 if (NULL != handle->th) 1290 if (NULL != handle->th)
1276 { 1291 {
1277 GNUNET_CLIENT_notify_transmit_ready_cancel (handle->th); 1292 GNUNET_CLIENT_notify_transmit_ready_cancel (handle->th);
@@ -1331,9 +1346,6 @@ GNUNET_MESH_tunnel_destroy (struct GNUNET_MESH_Tunnel *tunnel)
1331 LOG (GNUNET_ERROR_TYPE_DEBUG, "mesh: Destroying tunnel\n"); 1346 LOG (GNUNET_ERROR_TYPE_DEBUG, "mesh: Destroying tunnel\n");
1332 h = tunnel->mesh; 1347 h = tunnel->mesh;
1333 1348
1334 if (0 != tunnel->owner)
1335 GNUNET_PEER_change_rc (tunnel->owner, -1);
1336
1337 msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_DESTROY); 1349 msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_DESTROY);
1338 msg.header.size = htons (sizeof (struct GNUNET_MESH_TunnelMessage)); 1350 msg.header.size = htons (sizeof (struct GNUNET_MESH_TunnelMessage));
1339 msg.tunnel_id = htonl (tunnel->tid); 1351 msg.tunnel_id = htonl (tunnel->tid);