[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r32190 - gnunet/src/mesh
From: |
gnunet |
Subject: |
[GNUnet-SVN] r32190 - gnunet/src/mesh |
Date: |
Tue, 4 Feb 2014 13:36:29 +0100 |
Author: bartpolot
Date: 2014-02-04 13:36:29 +0100 (Tue, 04 Feb 2014)
New Revision: 32190
Modified:
gnunet/src/mesh/gnunet-service-mesh_peer.c
Log:
Use proper core priority for each message type and message origin.
Modified: gnunet/src/mesh/gnunet-service-mesh_peer.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_peer.c 2014-02-04 12:31:45 UTC (rev
32189)
+++ gnunet/src/mesh/gnunet-service-mesh_peer.c 2014-02-04 12:36:29 UTC (rev
32190)
@@ -508,7 +508,47 @@
/******************************** STATIC
***********************************/
/******************************************************************************/
+
/**
+ * Get priority for a queued message.
+ *
+ * @param q Queued message
+ *
+ * @return CORE priority to use.
+ */
+static enum GNUNET_CORE_Priority
+get_priority (struct MeshPeerQueue *q)
+{
+ enum GNUNET_CORE_Priority low;
+ enum GNUNET_CORE_Priority high;
+
+ if (NULL == q)
+ {
+ GNUNET_break (0);
+ return GNUNET_CORE_PRIO_BACKGROUND;
+ }
+
+ /* Relayed traffic has lower priority, our own traffic has higher */
+ if (NULL == q->c || GNUNET_NO == GMC_is_origin (q->c, q->fwd))
+ {
+ low = GNUNET_CORE_PRIO_BEST_EFFORT;
+ high = GNUNET_CORE_PRIO_URGENT;
+ }
+ else
+ {
+ low = GNUNET_CORE_PRIO_URGENT;
+ high = GNUNET_CORE_PRIO_CRITICAL_CONTROL;
+ }
+
+ /* Bulky payload has lower priority, control traffic has higher. */
+ if (GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED == q->type)
+ return low;
+ else
+ return high;
+}
+
+
+/**
* Iterator over tunnel hash map entries to destroy the tunnel during shutdown.
*
* @param cls closure
@@ -531,7 +571,6 @@
}
-
/**
* Destroy the peer_info and free any allocated resources linked to it
*
@@ -792,6 +831,7 @@
}
+
/**
* Core callback to write a queued packet to core buffer
*
@@ -837,8 +877,7 @@
LOG (GNUNET_ERROR_TYPE_DEBUG, "* not enough room, reissue\n");
peer->core_transmit =
GNUNET_CORE_notify_transmit_ready (core_handle,
- GNUNET_NO,
- GNUNET_CORE_PRIO_CRITICAL_CONTROL,
+ GNUNET_NO, get_priority (queue),
GNUNET_TIME_UNIT_FOREVER_REL,
dst_id,
queue->size,
@@ -910,8 +949,7 @@
{
peer->core_transmit =
GNUNET_CORE_notify_transmit_ready (core_handle,
- GNUNET_NO,
- GNUNET_CORE_PRIO_CRITICAL_CONTROL,
+ GNUNET_NO, get_priority (queue),
GNUNET_TIME_UNIT_FOREVER_REL,
dst_id,
queue->size,
@@ -1079,8 +1117,7 @@
GMP_2s (peer), size);
peer->core_transmit =
GNUNET_CORE_notify_transmit_ready (core_handle,
- GNUNET_NO,
- GNUNET_CORE_PRIO_CRITICAL_CONTROL,
+ GNUNET_NO, get_priority (queue),
GNUNET_TIME_UNIT_FOREVER_REL,
GNUNET_PEER_resolve2 (peer->id),
size,
@@ -1196,8 +1233,7 @@
size = q->size;
peer->core_transmit =
GNUNET_CORE_notify_transmit_ready (core_handle,
- GNUNET_NO,
- GNUNET_CORE_PRIO_CRITICAL_CONTROL,
+ GNUNET_NO, get_priority (q),
GNUNET_TIME_UNIT_FOREVER_REL,
GNUNET_PEER_resolve2 (peer->id),
size,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r32190 - gnunet/src/mesh,
gnunet <=