aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2012-09-21 17:35:25 +0000
committerBart Polot <bart@net.in.tum.de>2012-09-21 17:35:25 +0000
commit0f1f3a59d14d7f69ef0c12ecc2918beeff88c86f (patch)
tree60a318a253603e291965ef55addb41de1e955772
parent0cb283dbf191449b9e7109628d4b3edb6f6b42bf (diff)
- dont destroy a tunnel right when a client leaves, send pending messages first
-rw-r--r--src/mesh/gnunet-service-mesh.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c
index e8fb229dc7..c8c66e0897 100644
--- a/src/mesh/gnunet-service-mesh.c
+++ b/src/mesh/gnunet-service-mesh.c
@@ -4335,15 +4335,12 @@ tunnel_delete_peer (struct MeshTunnel *t, GNUNET_PEER_Id peer)
* @param cls closure (client that is disconnecting)
* @param key the hash of the local tunnel id (used to access the hashmap)
* @param value the value stored at the key (tunnel to destroy)
- *
- * @return GNUNET_OK on success
*/
-static int
+static void
tunnel_destroy_iterator (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct MeshTunnel *t = value;
struct MeshClient *c = cls;
- int r;
send_client_tunnel_disconnect(t, c);
if (c != t->owner)
@@ -4355,8 +4352,8 @@ tunnel_destroy_iterator (void *cls, const struct GNUNET_HashCode * key, void *va
return GNUNET_OK;
}
tunnel_send_destroy(t);
- r = tunnel_destroy (t);
- return r;
+ t->owner = NULL;
+ t->destroy = GNUNET_YES;
}
@@ -4831,7 +4828,8 @@ queue_send (void *cls, size_t size, void *buf)
cinfo->send_buffer[cinfo->send_buffer_start],
queue);
}
- if (cinfo->send_buffer_n > 0) {
+ if (cinfo->send_buffer_n > 0)
+ {
cinfo->send_buffer[cinfo->send_buffer_start] = NULL;
cinfo->send_buffer_n--;
cinfo->send_buffer_start++;
@@ -4967,13 +4965,15 @@ queue_add (void *cls, uint16_t type, size_t size,
if (NULL != cinfo->send_buffer[i])
{
GNUNET_break (cinfo->send_buffer_n == t->fwd_queue_max); // aka i == start
- queue_destroy(cinfo->send_buffer[cinfo->send_buffer_start], GNUNET_YES);
+ queue_destroy (cinfo->send_buffer[cinfo->send_buffer_start], GNUNET_YES);
cinfo->send_buffer_start++;
cinfo->send_buffer_start %= t->fwd_queue_max;
- cinfo->send_buffer_n--;
+ }
+ else
+ {
+ cinfo->send_buffer_n++;
}
cinfo->send_buffer[i] = queue;
- cinfo->send_buffer_n++;
if (cinfo->send_buffer_n > t->fwd_queue_max)
{
GNUNET_break (0);