gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r36964 - gnunet/src/cadet


From: gnunet
Subject: [GNUnet-SVN] r36964 - gnunet/src/cadet
Date: Wed, 30 Mar 2016 11:17:55 +0200

Author: bartpolot
Date: 2016-03-30 11:17:55 +0200 (Wed, 30 Mar 2016)
New Revision: 36964

Modified:
   gnunet/src/cadet/gnunet-service-cadet_connection.c
   gnunet/src/cadet/gnunet-service-cadet_peer.c
Log:
- refactor, test orderd

Modified: gnunet/src/cadet/gnunet-service-cadet_connection.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_connection.c  2016-03-30 09:17:54 UTC 
(rev 36963)
+++ gnunet/src/cadet/gnunet-service-cadet_connection.c  2016-03-30 09:17:55 UTC 
(rev 36964)
@@ -464,20 +464,6 @@
 
 
 /**
- * Mark a connection as "destroyed", to send all pending traffic and freeing
- * all associated resources, without accepting new status changes on it.
- *
- * @param c Connection to mark as destroyed.
- */
-static void
-mark_destroyed (struct CadetConnection *c)
-{
-  c->destroy = GNUNET_YES;
-  connection_change_state (c, CADET_CONNECTION_DESTROYED);
-}
-
-
-/**
  * Change the connection state. Cannot change a connection marked as destroyed.
  *
  * @param c Connection to change.
@@ -502,6 +488,20 @@
 
 
 /**
+ * Mark a connection as "destroyed", to send all pending traffic and freeing
+ * all associated resources, without accepting new status changes on it.
+ *
+ * @param c Connection to mark as destroyed.
+ */
+static void
+mark_destroyed (struct CadetConnection *c)
+{
+  c->destroy = GNUNET_YES;
+  connection_change_state (c, CADET_CONNECTION_DESTROYED);
+}
+
+
+/**
  * Callback called when a queued ACK message is sent.
  *
  * @param cls Closure (FC).

Modified: gnunet/src/cadet/gnunet-service-cadet_peer.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_peer.c        2016-03-30 09:17:54 UTC 
(rev 36963)
+++ gnunet/src/cadet/gnunet-service-cadet_peer.c        2016-03-30 09:17:55 UTC 
(rev 36964)
@@ -1091,7 +1091,22 @@
   return message_size + sizeof (struct GNUNET_CADET_ACK);
 }
 
+/**
+ * Test if a message type is connection management traffic
+ * or regular payload traffic.
+ *
+ * @param type Message type.
+ *
+ * @return #GNUNET_YES if connection management, #GNUNET_NO otherwise.
+ */
+static int
+is_connection_management (uint16_t type)
+{
+  return type == GNUNET_MESSAGE_TYPE_CADET_ACK ||
+         type == GNUNET_MESSAGE_TYPE_CADET_POLL;
+}
 
+
 /**
  * Fill a core buffer with the appropriate data for the queued message.
  *
@@ -1410,8 +1425,7 @@
   }
   GNUNET_CONTAINER_DLL_remove (peer->queue_head, peer->queue_tail, queue);
 
-  if (queue->type != GNUNET_MESSAGE_TYPE_CADET_ACK &&
-      queue->type != GNUNET_MESSAGE_TYPE_CADET_POLL)
+  if (!is_connection_management (queue->type))
   {
     peer->queue_n--;
   }
@@ -1497,16 +1511,13 @@
   }
 
   priority = 0;
-
-  if (GNUNET_MESSAGE_TYPE_CADET_POLL == type ||
-      GNUNET_MESSAGE_TYPE_CADET_ACK == type)
+  if (is_connection_management (type))
   {
     priority = 100;
   }
-
   LOG (GNUNET_ERROR_TYPE_DEBUG, "priority %d\n", priority);
 
-  call_core = (NULL == c || type == GNUNET_MESSAGE_TYPE_CADET_KX) ?
+  call_core = (NULL == c || GNUNET_MESSAGE_TYPE_CADET_KX == type) ?
                GNUNET_YES : GCC_is_sendable (c, fwd);
   q = GNUNET_new (struct CadetPeerQueue);
   q->cls = cls;




reply via email to

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