From df06904b49f8ef1ad4db2494ec6c723f2886ebc6 Mon Sep 17 00:00:00 2001 From: Bart Polot Date: Fri, 21 Mar 2014 18:44:18 +0000 Subject: [PATCH] - requeue messages on connection broken --- src/mesh/gnunet-service-mesh_connection.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/mesh/gnunet-service-mesh_connection.c b/src/mesh/gnunet-service-mesh_connection.c index b33737eba..02f703007 100644 --- a/src/mesh/gnunet-service-mesh_connection.c +++ b/src/mesh/gnunet-service-mesh_connection.c @@ -1741,7 +1741,7 @@ GMC_handle_confirm (void *cls, const struct GNUNET_PeerIdentity *peer, /** - * Core handler for notifications of broken paths + * Core handler for notifications of broken connections. * * @param cls Closure (unused). * @param id Peer identity of sending neighbor. @@ -1775,11 +1775,20 @@ GMC_handle_broken (void* cls, fwd = is_fwd (c, id); if (GMC_is_terminal (c, fwd)) { + struct GNUNET_MessageHeader *msg; + struct MeshPeer *peer; + + peer = get_hop (c, !fwd); path_invalidate (c->path); - if (0 < c->pending_messages) - c->destroy = GNUNET_YES; - else - GMC_destroy (c); + c->state = MESH_CONNECTION_DESTROYED; + while (NULL != (msg = GMP_connection_pop (peer, c))) + { + GNUNET_assert (NULL == + GMT_send_prebuilt_message (msg, c->t, NULL, GNUNET_YES, + NULL, NULL)); + } + + GMC_destroy (c); } else { -- 2.25.1