- cancel SYNACK retry task when forced to SYNACK by an incoming SYN
[oweals/gnunet.git] / src / mesh / gnunet-service-mesh_connection.c
index 007dcf27696a7ae1c88a87efbfb3c912d80fde99..5a87db99a676a07ccf13120a2a6ccc40751d9888 100644 (file)
@@ -855,7 +855,7 @@ send_broken2 (struct GNUNET_MeshHash *connection_id,
   msg->peer2 = *id2;
   neighbor = GMP_get_short (peer_id);
   GMP_queue_add (neighbor, msg,
-                 GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED,
+                 GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN,
                  sizeof (struct GNUNET_MESH_ConnectionBroken),
                  NULL, GNUNET_SYSERR, /* connection, fwd */
                  NULL, NULL); /* continuation */
@@ -1775,16 +1775,19 @@ GMC_handle_broken (void* cls,
   fwd = is_fwd (c, id);
   if (GMC_is_terminal (c, fwd))
   {
-    struct GNUNET_MessageHeader *msg;
-    struct MeshPeer *peer;
+    struct GNUNET_MessageHeader *out_msg;
+    struct MeshPeer *neighbor;
+    struct MeshPeer *endpoint;
 
-    peer = get_hop (c, !fwd);
+    neighbor = get_hop (c, !fwd);
+    endpoint = GMP_get_short (c->path->peers[c->path->length - 1]);
     path_invalidate (c->path);
+    GMP_notify_broken_link (endpoint, &msg->peer1, &msg->peer2);
     c->state = MESH_CONNECTION_DESTROYED;
-    while (NULL != (msg = GMP_connection_pop (peer, c)))
+    while (NULL != (out_msg = GMP_connection_pop (neighbor, c)))
     {
       GNUNET_assert (NULL ==
-                     GMT_send_prebuilt_message (msg, c->t, NULL, GNUNET_YES,
+                     GMT_send_prebuilt_message (out_msg, c->t, NULL, GNUNET_YES,
                                                 NULL, NULL));
     }