From 84b5ab75aa52914fb9db4eb427f5932ac02cf237 Mon Sep 17 00:00:00 2001 From: Bart Polot Date: Thu, 5 Sep 2013 04:28:44 +0000 Subject: [PATCH] - fix ack'ing - resend TUNNEL_DESTROY - explicitly log about faulty routes instead of letting core_api complain --- src/mesh/gnunet-service-mesh-enc.c | 35 ++++++++++++++++++------------ 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/src/mesh/gnunet-service-mesh-enc.c b/src/mesh/gnunet-service-mesh-enc.c index 8c056e0b3..78a33950d 100644 --- a/src/mesh/gnunet-service-mesh-enc.c +++ b/src/mesh/gnunet-service-mesh-enc.c @@ -3856,34 +3856,34 @@ send_ack (struct MeshConnection *c, struct MeshChannel *ch, int fwd) fwd ? "FWD" : "BCK", c, ch); if (NULL == c || connection_is_terminal (c, fwd)) { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " getting from Channel\n"); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " getting from all connections\n"); buffer = tunnel_get_buffer (NULL == c ? ch->t : c->t, fwd); } else { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " getting from Connection\n"); - GNUNET_assert (NULL != c); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " getting from one connection\n"); buffer = connection_get_buffer (c, fwd); } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " buffer available: %u\n", buffer); - if (NULL == c) - { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " sending on all connections\n"); - GNUNET_assert (NULL != ch); - channel_send_connections_ack (ch, buffer, fwd); - } - else if (connection_is_origin (c, fwd)) + if ( (NULL != ch && channel_is_terminal (ch, !fwd)) || + (NULL != c && connection_is_origin (c, fwd)) ) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " sending on channel...\n"); if (0 < buffer) { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " really sending!\n"); GNUNET_assert (NULL != ch); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " really sending!\n"); send_local_ack (ch, fwd); } } - else + else if (NULL == c) + { + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " sending on all connections\n"); + GNUNET_assert (NULL != ch); + channel_send_connections_ack (ch, buffer, fwd); + } + else { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " sending on connection\n"); connection_send_ack (c, buffer, fwd); @@ -3922,8 +3922,7 @@ channel_confirm (struct MeshChannel *ch, int fwd) /* TODO return? */ } } - if (GNUNET_NO == rel->client_ready) - send_local_ack (ch, fwd); + send_ack (NULL, ch, fwd); } @@ -4853,6 +4852,7 @@ queue_send (void *cls, size_t size, void *buf) /* Fill buf */ switch (queue->type) { + case GNUNET_MESSAGE_TYPE_MESH_TUNNEL_DESTROY: case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY: case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN: case GNUNET_MESSAGE_TYPE_MESH_FWD: @@ -5007,6 +5007,13 @@ queue_add (void *cls, uint16_t type, size_t size, GNUNET_break (0); return; } + + if (NULL == peer->connections) + { + /* We are not connected to this peer, ignore request. */ + GNUNET_break_op (0); + return; + } priority = 0; -- 2.25.1