clean up for configs
[oweals/gnunet.git] / src / mesh / gnunet-service-mesh_tunnel.c
index b6ff4f2d4cbcf4574f03548158b096ec5079a225..dab9df1e68f6f75fea375a4a1d3d078cd88ceef0 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)
   {
@@ -1451,7 +1460,8 @@ handle_ping (struct MeshTunnel3 *t,
   t_decrypt (t, &res.target, &msg->target, ping_encryption_size (), msg->iv);
   if (0 != memcmp (&my_full_id, &res.target, sizeof (my_full_id)))
   {
-    GNUNET_break_op (0);
+    GNUNET_STATISTICS_update (stats, "# malformed PINGs", 1, GNUNET_NO);
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "  WARNING malformed PING\n");
     LOG (GNUNET_ERROR_TYPE_DEBUG, "  e got %u\n", msg->nonce);
     LOG (GNUNET_ERROR_TYPE_DEBUG, "  e towards %s\n", GNUNET_i2s (&msg->target));
     LOG (GNUNET_ERROR_TYPE_DEBUG, "  got %u\n", res.nonce);
@@ -1562,6 +1572,7 @@ handle_decrypted (struct MeshTunnel3 *t,
       LOG (GNUNET_ERROR_TYPE_DEBUG,
            "end-to-end message not known (%u)\n",
            ntohs (msgh->type));
+      GMT_debug (t);
   }
 }