gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r17507 - gnunet/src/mesh


From: gnunet
Subject: [GNUnet-SVN] r17507 - gnunet/src/mesh
Date: Sat, 15 Oct 2011 12:08:06 +0200

Author: bartpolot
Date: 2011-10-15 12:08:05 +0200 (Sat, 15 Oct 2011)
New Revision: 17507

Modified:
   gnunet/src/mesh/gnunet-service-mesh.c
Log:
Fixed bug with cancellation of pendint transmisions on peer disconnect, added 
timeout for pending multicast data.

Modified: gnunet/src/mesh/gnunet-service-mesh.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh.c       2011-10-14 16:31:36 UTC (rev 
17506)
+++ gnunet/src/mesh/gnunet-service-mesh.c       2011-10-15 10:08:05 UTC (rev 
17507)
@@ -320,7 +320,7 @@
   struct MeshTunnel *t;
 
   /**
-   * Destination peer
+   * Neighbouring peer to whom we send the packet to
    */
   struct MeshPeerInfo *peer;
 
@@ -827,11 +827,20 @@
     struct MeshDataDescriptor *dd;
     struct MeshPathInfo *path_info;
 
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "MESH:   Cancelling data transmission at %u\n",
-                i);
-    GNUNET_CORE_notify_transmit_ready_cancel (peer->core_transmit[i]);
-    peer->core_transmit[i] = NULL;
+#if MESH_DEBUG
+    {
+      struct GNUNET_PeerIdentity id;
+
+      GNUNET_PEER_resolve (peer->id, &id);
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "MESH:   Cancelling data transmission at %s [%u]\n",
+                  GNUNET_i2s (&id),
+                  i);
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "MESH:    message type %u\n",
+                  peer->types[i]);
+    }
+#endif
     /* TODO: notify that tranmission has failed */
     switch (peer->types[i])
     {
@@ -851,7 +860,12 @@
         path_info = peer->infos[i];
         path_destroy(path_info->path);
         break;
+      default:
+        GNUNET_break (0);
+        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH:    type unknown!\n");
     }
+    GNUNET_CORE_notify_transmit_ready_cancel (peer->core_transmit[i]);
+    peer->core_transmit[i] = NULL;
     GNUNET_free (peer->infos[i]);
   } 
 }
@@ -999,9 +1013,9 @@
 
   path_info = GNUNET_malloc (sizeof (struct MeshPathInfo));
   path_info->path = p;
-  path_info->peer = peer;
   path_info->t = t;
   neighbor = peer_info_get(&id);
+  path_info->peer = neighbor;
   path_info->pos = peer_info_transmit_slot(neighbor);
   neighbor->types[path_info->pos] = GNUNET_MESSAGE_TYPE_MESH_PATH_CREATE;
   neighbor->infos[path_info->pos] = path_info;
@@ -1715,6 +1729,8 @@
   size_t size_needed;
   int i;
 
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "MESH: CREATE PATH sending...\n");
   size_needed =
       sizeof (struct GNUNET_MESH_ManipulatePath) +
       p->length * sizeof (struct GNUNET_PeerIdentity);
@@ -1735,7 +1751,17 @@
     return 0;
   }
   info->peer->core_transmit[info->pos] = NULL;
+#if MESH_DEBUG
+  {
+    struct GNUNET_PeerIdentity id;
 
+    GNUNET_PEER_resolve (peer->id, &id);
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "MESH:   setting core_transmit %s [%u] to NULL\n",
+                GNUNET_i2s (&id),
+                info->pos);
+  }
+#endif
   msg = (struct GNUNET_MESH_ManipulatePath *) buf;
   msg->header.size = htons (size_needed);
   msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_PATH_CREATE);
@@ -1858,11 +1884,8 @@
   {
     if (NULL != info->client)
     {
-      /* FIXME One unresponsive neighbor (who doesn't "call" tmt_rdy) can lock
-       *       the client from sending anything else to the service.
-       *       - Call receive_done after certain timeout.
-       *       - Here cancel the timeout.
-       */
+      if (GNUNET_SCHEDULER_NO_TASK != info->timeout_task)
+        GNUNET_SCHEDULER_cancel(info->timeout_task);
       GNUNET_SERVER_receive_done (info->client, GNUNET_OK);
     }
     GNUNET_free (info->data);
@@ -2591,11 +2614,11 @@
   struct GNUNET_MESH_Multicast *msg;
   size_t size;
 
-  t->path_refresh_task = GNUNET_SCHEDULER_NO_TASK;
   if (tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN)
   {
     return;
   }
+  t->path_refresh_task = GNUNET_SCHEDULER_NO_TASK;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "MESH: sending keepalive for tunnel %d\n",




reply via email to

[Prev in Thread] Current Thread [Next in Thread]