- dont GNUNET_break on non-validable paths, DHT seems to routinely be aware of core...
authorBart Polot <bart@net.in.tum.de>
Thu, 12 Dec 2013 18:34:20 +0000 (18:34 +0000)
committerBart Polot <bart@net.in.tum.de>
Thu, 12 Dec 2013 18:34:20 +0000 (18:34 +0000)
src/mesh/gnunet-service-mesh_connection.c
src/mesh/gnunet-service-mesh_peer.c

index ff5f2fd3ea8a494fd67848538bb84b96027d1333..d6e8d054f9fd6e9ec79f1ff39ac1ed54aa239772 100644 (file)
@@ -1149,9 +1149,9 @@ register_neighbors (struct MeshConnection *c)
       || GNUNET_NO == GMP_is_neighbor (prev_peer))
   {
     if (GMC_is_origin (c, GNUNET_YES))
-      GNUNET_break (0);
-    else
-      GNUNET_break_op (0);
+      GNUNET_STATISTICS_update (stats, "# local bad paths", 1, GNUNET_NO);
+    GNUNET_STATISTICS_update (stats, "# bad paths", 1, GNUNET_NO);
+    
     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));
@@ -1178,11 +1178,12 @@ unregister_neighbors (struct MeshConnection *c)
   struct MeshPeer *peer;
 
   peer = get_next_hop (c);
-  GMP_remove_connection (peer, c);
+  if (GNUNET_OK != GMP_remove_connection (peer, c))
+    GNUNET_break (MESH_CONNECTION_NEW == c->state);
 
   peer = get_prev_hop (c);
-  GMP_remove_connection (peer, c);
-
+  if (GNUNET_OK != GMP_remove_connection (peer, c))
+    GNUNET_break (MESH_CONNECTION_NEW == c->state);
 }
 
 
@@ -2220,17 +2221,18 @@ GMC_new (const struct GNUNET_HashCode *cid,
   c->own_pos = own_pos;
   c->path = p;
 
+  if (GNUNET_OK != register_neighbors (c))
+  {
+    GMC_destroy (c);
+    return NULL;
+  }
+
   if (0 == own_pos)
   {
     c->fwd_maintenance_task =
       GNUNET_SCHEDULER_add_delayed (create_connection_time,
                                     &connection_fwd_keepalive, c);
   }
-  if (GNUNET_OK != register_neighbors (c))
-  {
-    GMC_destroy (c);
-    return NULL;
-  }
 
   return c;
 }
index d347af1306d04414e88c4722d2d14b883f7c694b..40fe6d374d4460f1ed0af8a5260545c6b330d54d 100644 (file)
@@ -1608,8 +1608,7 @@ GMP_remove_connection (struct MeshPeer *peer,
 {
   if (NULL == peer || NULL == peer->connections)
   {
-    GNUNET_break (0);
-    LOG (GNUNET_ERROR_TYPE_WARNING,
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
          "Peer %s is not a neighbor!\n",
          GMP_2s (peer));
     return GNUNET_SYSERR;