From eb620579de05105499d35f21db8759682698df9d Mon Sep 17 00:00:00 2001 From: Bart Polot Date: Tue, 17 Dec 2013 10:05:04 +0000 Subject: [PATCH] - log fixes, limit kx to live tunnels --- src/mesh/gnunet-service-mesh_connection.c | 6 +++--- src/mesh/gnunet-service-mesh_connection.h | 2 +- src/mesh/gnunet-service-mesh_peer.c | 7 ++++--- src/mesh/gnunet-service-mesh_tunnel.c | 15 ++++++++++++--- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/mesh/gnunet-service-mesh_connection.c b/src/mesh/gnunet-service-mesh_connection.c index 0efecab92..6c14a0d1f 100644 --- a/src/mesh/gnunet-service-mesh_connection.c +++ b/src/mesh/gnunet-service-mesh_connection.c @@ -1187,7 +1187,7 @@ unregister_neighbors (struct MeshConnection *c) peer = get_next_hop (c); if (GNUNET_OK != GMP_remove_connection (peer, c)) { - GNUNET_break (MESH_CONNECTION_NEW == c->state + GNUNET_assert (MESH_CONNECTION_NEW == c->state || MESH_CONNECTION_DESTROYED == c->state); LOG (GNUNET_ERROR_TYPE_DEBUG, " cstate: %u\n", c->state); if (NULL != c->t) GMT_debug (c->t); @@ -1196,7 +1196,7 @@ unregister_neighbors (struct MeshConnection *c) peer = get_prev_hop (c); if (GNUNET_OK != GMP_remove_connection (peer, c)) { - GNUNET_break (MESH_CONNECTION_NEW == c->state + GNUNET_assert (MESH_CONNECTION_NEW == c->state || MESH_CONNECTION_DESTROYED == c->state); LOG (GNUNET_ERROR_TYPE_DEBUG, " cstate: %u\n", c->state); if (NULL != c->t) GMT_debug (c->t); @@ -2921,7 +2921,7 @@ GMC_stop_poll (struct MeshConnection *c, int fwd) * @param c Connection. */ const char * -GMC_2s (struct MeshConnection *c) +GMC_2s (const struct MeshConnection *c) { if (NULL == c) return "NULL"; diff --git a/src/mesh/gnunet-service-mesh_connection.h b/src/mesh/gnunet-service-mesh_connection.h index ef2cfaacd..f4722a6fc 100644 --- a/src/mesh/gnunet-service-mesh_connection.h +++ b/src/mesh/gnunet-service-mesh_connection.h @@ -517,7 +517,7 @@ GMC_stop_poll (struct MeshConnection *c, int fwd); * @param c Connection. */ const char * -GMC_2s (struct MeshConnection *c); +GMC_2s (const struct MeshConnection *c); #if 0 /* keep Emacsens' auto-indent happy */ { diff --git a/src/mesh/gnunet-service-mesh_peer.c b/src/mesh/gnunet-service-mesh_peer.c index 262310c83..e28338a8c 100644 --- a/src/mesh/gnunet-service-mesh_peer.c +++ b/src/mesh/gnunet-service-mesh_peer.c @@ -1093,9 +1093,7 @@ GMP_queue_cancel (struct MeshPeer *peer, struct MeshConnection *c) prev = q->prev; if (q->c == c) { - LOG (GNUNET_ERROR_TYPE_DEBUG, - "GMP_cancel_queue %s\n", - GM_m2s (q->type)); + LOG (GNUNET_ERROR_TYPE_DEBUG, "GMP_cancel_queue %s\n", GM_m2s (q->type)); GMP_queue_destroy (q, GNUNET_YES); /* Get next from prev, q->next might be already freed: @@ -1653,6 +1651,9 @@ int GMP_remove_connection (struct MeshPeer *peer, const struct MeshConnection *c) { + LOG (GNUNET_ERROR_TYPE_DEBUG, + "removing connection %s from peer %s\n", + GMC_2s (c), GMP_2s (peer)); if (NULL == peer || NULL == peer->connections) { LOG (GNUNET_ERROR_TYPE_DEBUG, diff --git a/src/mesh/gnunet-service-mesh_tunnel.c b/src/mesh/gnunet-service-mesh_tunnel.c index bfd35984b..eda392dd8 100644 --- a/src/mesh/gnunet-service-mesh_tunnel.c +++ b/src/mesh/gnunet-service-mesh_tunnel.c @@ -341,9 +341,12 @@ estate2s (enum MeshTunnel3EState es) static int is_ready (struct MeshTunnel3 *t) { - return (MESH_TUNNEL3_READY == t->cstate - && MESH_TUNNEL3_KEY_OK == t->estate) - || GMT_is_loopback (t); + int ready; + + GMT_debug (t); + ready = (MESH_TUNNEL3_READY == t->cstate && MESH_TUNNEL3_KEY_OK == t->estate); + ready = ready || GMT_is_loopback (t); + return ready; } @@ -889,6 +892,12 @@ send_kx (struct MeshTunnel3 *t, return; } + if (GNUNET_NO != t->destroy) + { + LOG (GNUNET_ERROR_TYPE_DEBUG, " being destroyed, why bother\n"); + return; + } + /* Must have a connection. */ if (NULL == t->connection_head) { -- 2.25.1