- add underlay api implementation
[oweals/gnunet.git] / src / mesh / gnunet-service-mesh_connection.c
index 9ce33d0e72c4475ae966517671fb721a2277af4f..72f7a122c037e930df59c08afcdda6528cfd1e7f 100644 (file)
@@ -1147,7 +1147,18 @@ register_neighbors (struct MeshConnection *c)
 
   if (GNUNET_NO == GMP_is_neighbor (next_peer)
       || GNUNET_NO == GMP_is_neighbor (prev_peer))
+  {
+    if (GMC_is_origin (c, GNUNET_YES))
+      GNUNET_break (0);
+    else
+      GNUNET_break_op (0);
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "  register neighbors failed\n");
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "  prev: %s, %d\n",
+         GMP_2s (prev_peer), GMP_is_neighbor (prev_peer));
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "  next: %s, %d\n",
+         GMP_2s (next_peer), GMP_is_neighbor (next_peer));
     return GNUNET_SYSERR;
+  }
 
   GMP_add_connection (next_peer, c);
   GMP_add_connection (prev_peer, c);
@@ -1491,7 +1502,6 @@ GMC_handle_broken (void* cls,
   }
 
   fwd = is_fwd (c, id);
-  connection_cancel_queues (c, !fwd);
   if (GMC_is_terminal (c, fwd))
   {
     if (0 < c->pending_messages)
@@ -1503,6 +1513,7 @@ GMC_handle_broken (void* cls,
   {
     GMC_send_prebuilt_message (message, c, fwd, GNUNET_YES, NULL, NULL);
     c->destroy = GNUNET_YES;
+    connection_cancel_queues (c, !fwd);
   }
 
   return GNUNET_OK;