- log
authorBart Polot <bart@net.in.tum.de>
Mon, 16 Dec 2013 22:50:22 +0000 (22:50 +0000)
committerBart Polot <bart@net.in.tum.de>
Mon, 16 Dec 2013 22:50:22 +0000 (22:50 +0000)
- don't process ACKs on dying connections

src/mesh/gnunet-service-mesh_connection.c

index a703e4b9676d4d7948418832a2816d499a6cf624..65cea3d69dce4a3e16006704c4562a46d4ef0b92 100644 (file)
@@ -1155,13 +1155,13 @@ register_neighbors (struct MeshConnection *c)
       || GNUNET_NO == GMP_is_neighbor (prev_peer))
   {
     if (GMC_is_origin (c, GNUNET_YES))
-    GNUNET_STATISTICS_update (stats, "# local bad paths", 1, GNUNET_NO);
+      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, neighbor: %d\n",
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "  prev: %s, neighbor?: %d\n",
          GMP_2s (prev_peer), GMP_is_neighbor (prev_peer));
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "  next: %s, neighbor: %d\n",
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "  next: %s, neighbor?: %d\n",
          GMP_2s (next_peer), GMP_is_neighbor (next_peer));
     return GNUNET_SYSERR;
   }
@@ -1186,15 +1186,19 @@ 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);
-    LOG (GNUNET_ERROR_TYPE_ERROR, "  cstate: %u\n", c->state);
+    GNUNET_break (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);
   }
 
   peer = get_prev_hop (c);
   if (GNUNET_OK != GMP_remove_connection (peer, c))
   {
-    GNUNET_break (MESH_CONNECTION_NEW == c->state);
-    LOG (GNUNET_ERROR_TYPE_ERROR, "  cstate: %u\n", c->state);
+    GNUNET_break (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);
   }
 }
 
@@ -1394,6 +1398,12 @@ GMC_handle_confirm (void *cls, const struct GNUNET_PeerIdentity *peer,
     return GNUNET_OK;
   }
 
+  if (GNUNET_NO != c->destroy)
+  {
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "  connection being destroyed\n");
+    return GNUNET_OK;
+  }
+
   oldstate = c->state;
   LOG (GNUNET_ERROR_TYPE_DEBUG, "  via peer %s\n", GNUNET_i2s (peer));
   pi = GMP_get (peer);
@@ -1638,8 +1648,7 @@ handle_mesh_encrypted (const struct GNUNET_PeerIdentity *peer,
   if (NULL == c)
   {
     GNUNET_STATISTICS_update (stats, "# unknown connection", 1, GNUNET_NO);
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "WARNING connection %s unknown\n",
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "WARNING enc on unknown connection %s\n",
          GNUNET_h2s (&msg->cid));
     return GNUNET_OK;
   }
@@ -1765,7 +1774,8 @@ handle_mesh_kx (const struct GNUNET_PeerIdentity *peer,
   if (NULL == c)
   {
     GNUNET_STATISTICS_update (stats, "# unknown connection", 1, GNUNET_NO);
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "WARNING connection unknown\n");
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "WARNING kx on unknown connection %s\n",
+         GNUNET_h2s (&msg->cid));
     return GNUNET_OK;
   }
   LOG (GNUNET_ERROR_TYPE_DEBUG, " on connection %s\n", GMC_2s (c));