*/
struct PendingMessage *pending_messages_tail;
+ /**
+ * How long does it typically take for us to transmit a message
+ * to this peer? (delay between the request being issued and
+ * the callback being invoked).
+ */
+ struct GNUNET_LOAD_Value *transmission_delay;
+
+ /**
+ * Time when the last transmission request was issued.
+ */
+ struct GNUNET_TIME_Absolute last_transmission_request_start;
+
/**
* Average priority of successful replies. Calculated
* as a moving average: new_avg = ((n-1)*last_avg+curr_prio) / n
uint32_t trust;
cp = GNUNET_malloc (sizeof (struct ConnectedPeer));
+ cp->transmission_delay = GNUNET_LOAD_value_init ();
cp->pid = GNUNET_PEER_intern (peer);
fn = get_trust_filename (peer);
GNUNET_CORE_notify_transmit_ready_cancel (cp->cth);
while (NULL != (pm = cp->pending_messages_head))
destroy_pending_message (pm, 0 /* delivery failed */);
+ GNUNET_LOAD_value_free (cp->transmission_delay);
GNUNET_break (0 == cp->pending_requests);
GNUNET_free (cp);
}
#endif
return 0;
}
+ GNUNET_LOAD_update (cp->transmission_delay,
+ GNUNET_TIME_absolute_get_duration (cp->last_transmission_request_start).value);
msize = 0;
while ( (NULL != (pm = cp->pending_messages_head) ) &&
(pm->msize <= size) )
{
GNUNET_PEER_resolve (cp->pid,
&pid);
+ cp->last_transmission_request_start = GNUNET_TIME_absolute_get ();
cp->cth = GNUNET_CORE_notify_transmit_ready (core,
pm->priority,
GNUNET_CONSTANTS_SERVICE_TIMEOUT,
if (NULL != cp->cth)
GNUNET_CORE_notify_transmit_ready_cancel (cp->cth);
/* need to schedule transmission */
+ cp->last_transmission_request_start = GNUNET_TIME_absolute_get ();
cp->cth = GNUNET_CORE_notify_transmit_ready (core,
cp->pending_messages_head->priority,
MAX_TRANSMIT_DELAY,