diff options
author | Bart Polot <bart@net.in.tum.de> | 2012-09-21 17:35:25 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2012-09-21 17:35:25 +0000 |
commit | 0f1f3a59d14d7f69ef0c12ecc2918beeff88c86f (patch) | |
tree | 60a318a253603e291965ef55addb41de1e955772 /src | |
parent | 0cb283dbf191449b9e7109628d4b3edb6f6b42bf (diff) | |
download | gnunet-0f1f3a59d14d7f69ef0c12ecc2918beeff88c86f.tar.gz gnunet-0f1f3a59d14d7f69ef0c12ecc2918beeff88c86f.zip |
- dont destroy a tunnel right when a client leaves, send pending messages first
Diffstat (limited to 'src')
-rw-r--r-- | src/mesh/gnunet-service-mesh.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c index e8fb229dc..c8c66e089 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) | |||
4335 | * @param cls closure (client that is disconnecting) | 4335 | * @param cls closure (client that is disconnecting) |
4336 | * @param key the hash of the local tunnel id (used to access the hashmap) | 4336 | * @param key the hash of the local tunnel id (used to access the hashmap) |
4337 | * @param value the value stored at the key (tunnel to destroy) | 4337 | * @param value the value stored at the key (tunnel to destroy) |
4338 | * | ||
4339 | * @return GNUNET_OK on success | ||
4340 | */ | 4338 | */ |
4341 | static int | 4339 | static void |
4342 | tunnel_destroy_iterator (void *cls, const struct GNUNET_HashCode * key, void *value) | 4340 | tunnel_destroy_iterator (void *cls, const struct GNUNET_HashCode * key, void *value) |
4343 | { | 4341 | { |
4344 | struct MeshTunnel *t = value; | 4342 | struct MeshTunnel *t = value; |
4345 | struct MeshClient *c = cls; | 4343 | struct MeshClient *c = cls; |
4346 | int r; | ||
4347 | 4344 | ||
4348 | send_client_tunnel_disconnect(t, c); | 4345 | send_client_tunnel_disconnect(t, c); |
4349 | if (c != t->owner) | 4346 | if (c != t->owner) |
@@ -4355,8 +4352,8 @@ tunnel_destroy_iterator (void *cls, const struct GNUNET_HashCode * key, void *va | |||
4355 | return GNUNET_OK; | 4352 | return GNUNET_OK; |
4356 | } | 4353 | } |
4357 | tunnel_send_destroy(t); | 4354 | tunnel_send_destroy(t); |
4358 | r = tunnel_destroy (t); | 4355 | t->owner = NULL; |
4359 | return r; | 4356 | t->destroy = GNUNET_YES; |
4360 | } | 4357 | } |
4361 | 4358 | ||
4362 | 4359 | ||
@@ -4831,7 +4828,8 @@ queue_send (void *cls, size_t size, void *buf) | |||
4831 | cinfo->send_buffer[cinfo->send_buffer_start], | 4828 | cinfo->send_buffer[cinfo->send_buffer_start], |
4832 | queue); | 4829 | queue); |
4833 | } | 4830 | } |
4834 | if (cinfo->send_buffer_n > 0) { | 4831 | if (cinfo->send_buffer_n > 0) |
4832 | { | ||
4835 | cinfo->send_buffer[cinfo->send_buffer_start] = NULL; | 4833 | cinfo->send_buffer[cinfo->send_buffer_start] = NULL; |
4836 | cinfo->send_buffer_n--; | 4834 | cinfo->send_buffer_n--; |
4837 | cinfo->send_buffer_start++; | 4835 | cinfo->send_buffer_start++; |
@@ -4967,13 +4965,15 @@ queue_add (void *cls, uint16_t type, size_t size, | |||
4967 | if (NULL != cinfo->send_buffer[i]) | 4965 | if (NULL != cinfo->send_buffer[i]) |
4968 | { | 4966 | { |
4969 | GNUNET_break (cinfo->send_buffer_n == t->fwd_queue_max); // aka i == start | 4967 | GNUNET_break (cinfo->send_buffer_n == t->fwd_queue_max); // aka i == start |
4970 | queue_destroy(cinfo->send_buffer[cinfo->send_buffer_start], GNUNET_YES); | 4968 | queue_destroy (cinfo->send_buffer[cinfo->send_buffer_start], GNUNET_YES); |
4971 | cinfo->send_buffer_start++; | 4969 | cinfo->send_buffer_start++; |
4972 | cinfo->send_buffer_start %= t->fwd_queue_max; | 4970 | cinfo->send_buffer_start %= t->fwd_queue_max; |
4973 | cinfo->send_buffer_n--; | 4971 | } |
4972 | else | ||
4973 | { | ||
4974 | cinfo->send_buffer_n++; | ||
4974 | } | 4975 | } |
4975 | cinfo->send_buffer[i] = queue; | 4976 | cinfo->send_buffer[i] = queue; |
4976 | cinfo->send_buffer_n++; | ||
4977 | if (cinfo->send_buffer_n > t->fwd_queue_max) | 4977 | if (cinfo->send_buffer_n > t->fwd_queue_max) |
4978 | { | 4978 | { |
4979 | GNUNET_break (0); | 4979 | GNUNET_break (0); |