[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r28246 - gnunet/src/mesh
From: |
gnunet |
Subject: |
[GNUnet-SVN] r28246 - gnunet/src/mesh |
Date: |
Mon, 22 Jul 2013 18:14:51 +0200 |
Author: bartpolot
Date: 2013-07-22 18:14:51 +0200 (Mon, 22 Jul 2013)
New Revision: 28246
Modified:
gnunet/src/mesh/gnunet-service-mesh.c
Log:
- unregister ports on client disconnect
Modified: gnunet/src/mesh/gnunet-service-mesh.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh.c 2013-07-22 16:03:07 UTC (rev
28245)
+++ gnunet/src/mesh/gnunet-service-mesh.c 2013-07-22 16:14:51 UTC (rev
28246)
@@ -3283,7 +3283,35 @@
return GNUNET_OK;
}
+
/**
+ * remove client's ports from the global hashmap on diconnect.
+ *
+ * @param cls Closure (unused).
+ * @param key Port.
+ * @param value ThClient structure.
+ *
+ * @return GNUNET_OK, keep iterating.
+ */
+static int
+client_release_ports (void *cls,
+ uint32_t key,
+ void *value)
+{
+ int res;
+
+ res = GNUNET_CONTAINER_multihashmap32_remove (ports, key, value);
+ if (GNUNET_YES != res)
+ {
+ GNUNET_break (0);
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Port %u by client %p was not registered.\n",
+ key, value);
+ }
+ return GNUNET_OK;
+}
+
+/**
* Timeout function due to lack of keepalive/traffic from the owner.
* Destroys tunnel if called.
*
@@ -4826,12 +4854,16 @@
if (NULL != c->incoming_tunnels)
{
GNUNET_CONTAINER_multihashmap32_iterate (c->incoming_tunnels,
- &tunnel_destroy_iterator, c);
+ &tunnel_destroy_iterator, c);
GNUNET_CONTAINER_multihashmap32_destroy (c->incoming_tunnels);
}
if (NULL != c->ports)
+ {
+ GNUNET_CONTAINER_multihashmap32_iterate (c->ports,
+ &client_release_ports, c);
GNUNET_CONTAINER_multihashmap32_destroy (c->ports);
+ }
next = c->next;
GNUNET_CONTAINER_DLL_remove (clients_head, clients_tail, c);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " CLIENT FREE at %p\n", c);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r28246 - gnunet/src/mesh,
gnunet <=