aboutsummaryrefslogtreecommitdiff
path: root/src/mesh
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2012-01-19 15:20:17 +0000
committerBart Polot <bart@net.in.tum.de>2012-01-19 15:20:17 +0000
commit17fc0828058e47ea0bd8428056fe88ee7e46749a (patch)
tree4e5917b13fdd72e880a51a8dbb5d673ffdb45318 /src/mesh
parent9b41d405b9d318b6748b8c233c0b80a4e76bcf43 (diff)
downloadgnunet-17fc0828058e47ea0bd8428056fe88ee7e46749a.tar.gz
gnunet-17fc0828058e47ea0bd8428056fe88ee7e46749a.zip
Fixed client disconnect bug, delimited debug messages.
Diffstat (limited to 'src/mesh')
-rw-r--r--src/mesh/gnunet-service-mesh.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c
index d871ee12d..9f988a17e 100644
--- a/src/mesh/gnunet-service-mesh.c
+++ b/src/mesh/gnunet-service-mesh.c
@@ -2200,6 +2200,7 @@ tunnel_destroy (struct MeshTunnel *t)
2200 if (NULL == t) 2200 if (NULL == t)
2201 return GNUNET_OK; 2201 return GNUNET_OK;
2202 2202
2203 r = GNUNET_OK;
2203 c = t->client; 2204 c = t->client;
2204#if MESH_DEBUG 2205#if MESH_DEBUG
2205 { 2206 {
@@ -2218,13 +2219,20 @@ tunnel_destroy (struct MeshTunnel *t)
2218 { 2219 {
2219 r = GNUNET_SYSERR; 2220 r = GNUNET_SYSERR;
2220 } 2221 }
2221 2222
2222 GNUNET_CRYPTO_hash (&t->local_tid, sizeof (MESH_TunnelNumber), &hash); 2223 GNUNET_CRYPTO_hash (&t->local_tid, sizeof (MESH_TunnelNumber), &hash);
2223 if (NULL != c && 2224 if (NULL != c &&
2224 GNUNET_YES != GNUNET_CONTAINER_multihashmap_remove (c->tunnels, &hash, t)) 2225 GNUNET_YES != GNUNET_CONTAINER_multihashmap_remove (c->tunnels, &hash, t))
2225 { 2226 {
2226 r = GNUNET_SYSERR; 2227 r = GNUNET_SYSERR;
2227 } 2228 }
2229 c = t->client_dest;
2230 GNUNET_CRYPTO_hash (&t->local_tid_dest, sizeof (MESH_TunnelNumber), &hash);
2231 if (NULL != c &&
2232 GNUNET_YES != GNUNET_CONTAINER_multihashmap_remove (c->tunnels, &hash, t))
2233 {
2234 r = GNUNET_SYSERR;
2235 }
2228 if (t->local_tid >= GNUNET_MESH_LOCAL_TUNNEL_ID_SERV) 2236 if (t->local_tid >= GNUNET_MESH_LOCAL_TUNNEL_ID_SERV)
2229 { 2237 {
2230 GNUNET_CRYPTO_hash (&t->local_tid, sizeof (MESH_TunnelNumber), &hash); 2238 GNUNET_CRYPTO_hash (&t->local_tid, sizeof (MESH_TunnelNumber), &hash);
@@ -2296,6 +2304,10 @@ tunnel_destroy_iterator (void *cls, const GNUNET_HashCode * key, void *value)
2296 send_client_tunnel_disconnect(t, c); 2304 send_client_tunnel_disconnect(t, c);
2297 if (c == t->client_dest) 2305 if (c == t->client_dest)
2298 { 2306 {
2307#if MESH_DEBUG
2308 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2309 "Client %u is destination, keeping the tunnel alive.\n", c->id);
2310#endif
2299 t->client_dest = NULL; 2311 t->client_dest = NULL;
2300 t->local_tid_dest = 0; 2312 t->local_tid_dest = 0;
2301 return GNUNET_OK; 2313 return GNUNET_OK;
@@ -3453,7 +3465,9 @@ handle_local_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client)
3453 struct MeshClient *c; 3465 struct MeshClient *c;
3454 struct MeshClient *next; 3466 struct MeshClient *next;
3455 3467
3468#if MESH_DEBUG
3456 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: client disconnected\n"); 3469 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: client disconnected\n");
3470#endif
3457 if (client == NULL) 3471 if (client == NULL)
3458 { 3472 {
3459 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: (SERVER DOWN)\n"); 3473 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: (SERVER DOWN)\n");
@@ -3464,7 +3478,9 @@ handle_local_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client)
3464 { 3478 {
3465 if (c->handle != client) 3479 if (c->handle != client)
3466 { 3480 {
3481#if MESH_DEBUG
3467 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: ... searching\n"); 3482 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: ... searching\n");
3483#endif
3468 c = c->next; 3484 c = c->next;
3469 continue; 3485 continue;
3470 } 3486 }
@@ -3497,12 +3513,16 @@ handle_local_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client)
3497 GNUNET_CONTAINER_multihashmap_destroy (c->types); 3513 GNUNET_CONTAINER_multihashmap_destroy (c->types);
3498 next = c->next; 3514 next = c->next;
3499 GNUNET_CONTAINER_DLL_remove (clients, clients_tail, c); 3515 GNUNET_CONTAINER_DLL_remove (clients, clients_tail, c);
3516#if MESH_DEBUG
3500 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: CLIENT FREE at %p\n", c); 3517 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: CLIENT FREE at %p\n", c);
3518#endif
3501 GNUNET_free (c); 3519 GNUNET_free (c);
3502 c = next; 3520 c = next;
3503 } 3521 }
3504 3522
3523#if MESH_DEBUG
3505 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: done!\n"); 3524 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: done!\n");
3525#endif
3506 return; 3526 return;
3507} 3527}
3508 3528