gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r30088 - gnunet/src/mesh
Date: Thu, 10 Oct 2013 14:46:15 +0200

Author: bartpolot
Date: 2013-10-10 14:46:15 +0200 (Thu, 10 Oct 2013)
New Revision: 30088

Modified:
   gnunet/src/mesh/gnunet-service-mesh_connection.c
   gnunet/src/mesh/gnunet-service-mesh_peer.c
   gnunet/src/mesh/gnunet-service-mesh_peer.h
Log:
- move queue canceling to peer.c


Modified: gnunet/src/mesh/gnunet-service-mesh_connection.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_connection.c    2013-10-10 12:39:45 UTC 
(rev 30087)
+++ gnunet/src/mesh/gnunet-service-mesh_connection.c    2013-10-10 12:46:15 UTC 
(rev 30088)
@@ -723,8 +723,7 @@
 static void
 connection_cancel_queues (struct MeshConnection *c, int fwd)
 {
-  struct MeshPeerQueue *q;
-  struct MeshPeerQueue *next;
+
   struct MeshFlowControl *fc;
   struct MeshPeer *peer;
 
@@ -733,33 +732,16 @@
     GNUNET_break (0);
     return;
   }
-  fc = fwd ? &c->fwd_fc : &c->bck_fc;
+
   peer = connection_get_hop (c, fwd);
+  GMP_queue_cancel (peer, c);
 
-  for (q = peer->queue_head; NULL != q; q = next)
+  fc = fwd ? &c->fwd_fc : &c->bck_fc;
+  if (GNUNET_SCHEDULER_NO_TASK != fc->poll_task)
   {
-    next = q->next;
-    if (q->c == c)
-    {
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-                  "connection_cancel_queue %s\n",
-                  GNUNET_MESH_DEBUG_M2S (q->type));
-      queue_destroy (q, GNUNET_YES);
-    }
+    GNUNET_SCHEDULER_cancel (fc->poll_task);
+    fc->poll_task = GNUNET_SCHEDULER_NO_TASK;
   }
-  if (NULL == peer->queue_head)
-  {
-    if (NULL != peer->core_transmit)
-    {
-      GNUNET_CORE_notify_transmit_ready_cancel (peer->core_transmit);
-      peer->core_transmit = NULL;
-    }
-    if (GNUNET_SCHEDULER_NO_TASK != fc->poll_task)
-    {
-      GNUNET_SCHEDULER_cancel (fc->poll_task);
-      fc->poll_task = GNUNET_SCHEDULER_NO_TASK;
-    }
-  }
 }
 
 

Modified: gnunet/src/mesh/gnunet-service-mesh_peer.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_peer.c  2013-10-10 12:39:45 UTC (rev 
30087)
+++ gnunet/src/mesh/gnunet-service-mesh_peer.c  2013-10-10 12:46:15 UTC (rev 
30088)
@@ -1407,7 +1407,40 @@
 }
 
 
+/**
+ * Cancel all queued messages to a peer that belong to a certain connection.
+ *
+ * @param peer Peer towards whom to cancel.
+ * @param c Connection whose queued messages to cancel.
+ */
+void
+GMP_queue_cancel (struct MeshPeer *peer, struct MeshConnection *c)
+{
+  struct MeshPeerQueue *q;
+  struct MeshPeerQueue *next;
 
+  for (q = peer->queue_head; NULL != q; q = next)
+  {
+    next = q->next;
+    if (q->c == c)
+    {
+      LOG (GNUNET_ERROR_TYPE_DEBUG,
+                  "connection_cancel_queue %s\n",
+                  GNUNET_MESH_DEBUG_M2S (q->type));
+      GMP_queue_destroy (q, GNUNET_YES);
+    }
+  }
+  if (NULL == peer->queue_head)
+  {
+    if (NULL != peer->core_transmit)
+    {
+      GNUNET_CORE_notify_transmit_ready_cancel (peer->core_transmit);
+      peer->core_transmit = NULL;
+    }
+  }
+}
+
+
 /**
  * Initialize the peer subsystem.
  *
@@ -1624,6 +1657,14 @@
 }
 
 
+/**
+ * Remove a connection from a neighboring peer.
+ *
+ * @param peer Peer to remove connection from.
+ * @param c Connection to remove.
+ *
+ * @return GNUNET_OK on success.
+ */
 int
 GMP_remove_connection (struct MeshPeer *peer,
                        const struct MeshConnection *c)

Modified: gnunet/src/mesh/gnunet-service-mesh_peer.h
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_peer.h  2013-10-10 12:39:45 UTC (rev 
30087)
+++ gnunet/src/mesh/gnunet-service-mesh_peer.h  2013-10-10 12:46:15 UTC (rev 
30088)
@@ -98,6 +98,15 @@
                GMP_sent callback, void *callback_cls);
 
 /**
+ * Cancel all queued messages to a peer that belong to a certain connection.
+ *
+ * @param peer Peer towards whom to cancel.
+ * @param c Connection whose queued messages to cancel.
+ */
+void
+GMP_queue_cancel (struct MeshPeer *peer, struct MeshConnection *c);
+
+/**
  * Set tunnel.
  *
  * @param peer Peer.
@@ -132,6 +141,14 @@
 int
 GMP_add_connection (struct MeshPeer *peer, struct MeshConnection *c);
 
+/**
+ * Remove a connection from a neighboring peer.
+ *
+ * @param peer Peer to remove connection from.
+ * @param c Connection to remove.
+ *
+ * @return GNUNET_OK on success.
+ */
 int
 GMP_remove_connection (struct MeshPeer *peer, struct MeshConnection *c);
 




reply via email to

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