/******************************** 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.
*
}
-
/**
* Destroy the peer_info and free any allocated resources linked to it
*
}
+
/**
* Core callback to write a queued packet to core buffer
*
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,
{
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,
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,
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,