- various minor fixes and breaks
authorBart Polot <bart@net.in.tum.de>
Mon, 16 Dec 2013 09:25:18 +0000 (09:25 +0000)
committerBart Polot <bart@net.in.tum.de>
Mon, 16 Dec 2013 09:25:18 +0000 (09:25 +0000)
src/mesh/gnunet-service-mesh_connection.c
src/mesh/gnunet-service-mesh_peer.c
src/mesh/gnunet-service-mesh_tunnel.c

index d6e8d054f9fd6e9ec79f1ff39ac1ed54aa239772..2a543c2e1abee827e5b5da6333c0000ec9ed3f4f 100644 (file)
@@ -1151,7 +1151,7 @@ register_neighbors (struct MeshConnection *c)
     if (GMC_is_origin (c, GNUNET_YES))
       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));
@@ -1292,7 +1292,7 @@ GMC_handle_create (void *cls, const struct GNUNET_PeerIdentity *peer,
     }
     LOG (GNUNET_ERROR_TYPE_DEBUG, "  Own position: %u\n", own_pos);
     GMP_add_path_to_all (path, GNUNET_NO);
-        LOG (GNUNET_ERROR_TYPE_DEBUG, "  Creating connection\n");
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "  Creating connection\n");
     c = GMC_new (cid, NULL, path_duplicate (path), own_pos);
     if (NULL == c)
     {
@@ -2204,20 +2204,17 @@ GMC_new (const struct GNUNET_HashCode *cid,
 
   c = GNUNET_new (struct MeshConnection);
   c->id = *cid;
-  GNUNET_CONTAINER_multihashmap_put (connections, &c->id, c,
-                                     GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
+  GNUNET_assert (GNUNET_OK ==
+                 GNUNET_CONTAINER_multihashmap_put (connections,
+                                                    &c->id, c,
+                                                    GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
   fc_init (&c->fwd_fc);
   fc_init (&c->bck_fc);
   c->fwd_fc.c = c;
   c->bck_fc.c = c;
 
   c->t = t;
-  if (own_pos > p->length - 1)
-  {
-    GNUNET_break (0);
-    GMC_destroy (c);
-    return NULL;
-  }
+  GNUNET_assert (own_pos <= p->length - 1);
   c->own_pos = own_pos;
   c->path = p;
 
index 40fe6d374d4460f1ed0af8a5260545c6b330d54d..6c5bbf752c35aca56e97c615a5680a5316bc182d 100644 (file)
@@ -1325,7 +1325,7 @@ GMP_connect (struct MeshPeer *peer)
          *
          * Re-running the DHT GET should give core time to callback.
          */
-        GNUNET_break(0);
+        GNUNET_break (0);
         rerun_search = GNUNET_YES;
       }
       else
index 977caaff2bc277612fc7e03a734103168f57af7c..f192bb05b5ac49cc6a30c603164bff95c882721c 100644 (file)
@@ -2001,7 +2001,7 @@ GMT_use_path (struct MeshTunnel3 *t, struct MeshPeerPath *p)
   }
   if (own_pos > p->length - 1)
   {
-    GNUNET_break (0);
+    GNUNET_break_op (0);
     return NULL;
   }