- log fixes, limit kx to live tunnels
authorBart Polot <bart@net.in.tum.de>
Tue, 17 Dec 2013 10:05:04 +0000 (10:05 +0000)
committerBart Polot <bart@net.in.tum.de>
Tue, 17 Dec 2013 10:05:04 +0000 (10:05 +0000)
src/mesh/gnunet-service-mesh_connection.c
src/mesh/gnunet-service-mesh_connection.h
src/mesh/gnunet-service-mesh_peer.c
src/mesh/gnunet-service-mesh_tunnel.c

index 0efecab92963f3016abaf85bb4136588149af561..6c14a0d1f3fbb49dda24a4e34e63d6426909d11c 100644 (file)
@@ -1187,7 +1187,7 @@ unregister_neighbors (struct MeshConnection *c)
   peer = get_next_hop (c);
   if (GNUNET_OK != GMP_remove_connection (peer, c))
   {
-    GNUNET_break (MESH_CONNECTION_NEW == c->state
+    GNUNET_assert (MESH_CONNECTION_NEW == c->state
                   || MESH_CONNECTION_DESTROYED == c->state);
     LOG (GNUNET_ERROR_TYPE_DEBUG, "  cstate: %u\n", c->state);
     if (NULL != c->t) GMT_debug (c->t);
@@ -1196,7 +1196,7 @@ unregister_neighbors (struct MeshConnection *c)
   peer = get_prev_hop (c);
   if (GNUNET_OK != GMP_remove_connection (peer, c))
   {
-    GNUNET_break (MESH_CONNECTION_NEW == c->state
+    GNUNET_assert (MESH_CONNECTION_NEW == c->state
                   || MESH_CONNECTION_DESTROYED == c->state);
     LOG (GNUNET_ERROR_TYPE_DEBUG, "  cstate: %u\n", c->state);
     if (NULL != c->t) GMT_debug (c->t);
@@ -2921,7 +2921,7 @@ GMC_stop_poll (struct MeshConnection *c, int fwd)
  * @param c Connection.
  */
 const char *
-GMC_2s (struct MeshConnection *c)
+GMC_2s (const struct MeshConnection *c)
 {
   if (NULL == c)
     return "NULL";
index ef2cfaacd21f99b2cf2d88ee87001fa66a756d24..f4722a6fce8ac3bf990cb931a5ef67144d36136b 100644 (file)
@@ -517,7 +517,7 @@ GMC_stop_poll (struct MeshConnection *c, int fwd);
  * @param c Connection.
  */
 const char *
-GMC_2s (struct MeshConnection *c);
+GMC_2s (const struct MeshConnection *c);
 
 #if 0                           /* keep Emacsens' auto-indent happy */
 {
index 262310c836189d2d46f6a9e532fea7d5cfd53047..e28338a8c3e104881abd881a6c1df45f6e8c5509 100644 (file)
@@ -1093,9 +1093,7 @@ GMP_queue_cancel (struct MeshPeer *peer, struct MeshConnection *c)
     prev = q->prev;
     if (q->c == c)
     {
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-                  "GMP_cancel_queue %s\n",
-                  GM_m2s (q->type));
+      LOG (GNUNET_ERROR_TYPE_DEBUG, "GMP_cancel_queue %s\n", GM_m2s (q->type));
       GMP_queue_destroy (q, GNUNET_YES);
 
       /* Get next from prev, q->next might be already freed:
@@ -1653,6 +1651,9 @@ int
 GMP_remove_connection (struct MeshPeer *peer,
                        const struct MeshConnection *c)
 {
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "removing connection %s from peer %s\n",
+       GMC_2s (c), GMP_2s (peer));
   if (NULL == peer || NULL == peer->connections)
   {
     LOG (GNUNET_ERROR_TYPE_DEBUG,
index bfd35984ba9efb6929ef8ef522b76d0304fc0a52..eda392dd826ee1844cc600e5620aabf970445637 100644 (file)
@@ -341,9 +341,12 @@ estate2s (enum MeshTunnel3EState es)
 static int
 is_ready (struct MeshTunnel3 *t)
 {
-  return (MESH_TUNNEL3_READY == t->cstate
-          && MESH_TUNNEL3_KEY_OK == t->estate)
-         || GMT_is_loopback (t);
+  int ready;
+
+  GMT_debug (t);
+  ready = (MESH_TUNNEL3_READY == t->cstate && MESH_TUNNEL3_KEY_OK == t->estate);
+  ready = ready || GMT_is_loopback (t);
+  return ready;
 }
 
 
@@ -889,6 +892,12 @@ send_kx (struct MeshTunnel3 *t,
     return;
   }
 
+  if (GNUNET_NO != t->destroy)
+  {
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "  being destroyed, why bother\n");
+    return;
+  }
+
   /* Must have a connection. */
   if (NULL == t->connection_head)
   {