- URGENT: Congestion/flow control (CHANNEL):
+ estimate max bandwidth using bursts and use to for CONGESTION CONTROL!
(and figure out how/where to use this!)
- + get current RTT from connection; use that for initial retransmissions!
+ figure out flow control without ACKs (unreliable traffic!)
- HIGH: revisit handling of 'unbuffered' traffic! (CHANNEL/TUNNEL)
*
* TODO:
* - Congestion/flow control:
- * + calculate current RTT if possible, use that for initial retransmissions
- * (NOTE: needs us to learn which connection the tunnel uses for the message!)
* + estimate max bandwidth using bursts and use to for CONGESTION CONTROL!
* (and figure out how/where to use this!)
* + figure out flow control without ACKs (unreliable traffic!)
*/
struct GNUNET_TIME_Relative retry_time;
- /**
- * How long does it usually take to get an ACK.
- */
- struct GNUNET_TIME_Relative expected_delay;
-
/**
* Bitfield of already-received messages past @e mid_recv.
*/
GCC_ack_expected (cid);
}
}
- if (0 == crm->retry_delay.rel_value_us)
- crm->retry_delay = ch->expected_delay;
- else
- crm->retry_delay = GNUNET_TIME_STD_BACKOFF (crm->retry_delay);
+ if ( (0 == crm->retry_delay.rel_value_us) &&
+ (NULL != cid) )
+ {
+ struct CadetConnection *cc = GCC_lookup (cid);
+
+ if (NULL != cc)
+ crm->retry_delay = GCC_get_metrics (cc)->aged_latency;
+ else
+ crm->retry_delay = ch->retry_time;
+ }
+ crm->retry_delay = GNUNET_TIME_STD_BACKOFF (crm->retry_delay);
crm->retry_delay = GNUNET_TIME_relative_max (crm->retry_delay,
MIN_RTT_DELAY);
crm->next_retry = GNUNET_TIME_relative_to_absolute (crm->retry_delay);
};
+/**
+ * Lookup a connection by its identifier.
+ *
+ * @param cid identifier to resolve
+ * @return NULL if connection was not found
+ */
+struct CadetConnection *
+GCC_lookup (const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid)
+{
+ return GNUNET_CONTAINER_multishortmap_get (connections,
+ &cid->connection_of_tunnel);
+}
+
+
/**
* Update the connection state. Also triggers the necessary
* MQM notifications.
{
struct CadetConnection *cc;
- cc = GNUNET_CONTAINER_multishortmap_get (connections,
- &cid->connection_of_tunnel);
+ cc = GCC_lookup (cid);
if (NULL == cc)
return; /* whopise, connection alredy down? */
cc->metrics.num_acked_transmissions++;
{
struct CadetConnection *cc;
- cc = GNUNET_CONTAINER_multishortmap_get (connections,
- &cid->connection_of_tunnel);
+ cc = GCC_lookup (cid);
if (NULL == cc)
return; /* whopise, connection alredy down? */
cc->metrics.num_successes++;
double weight;
double result;
- cc = GNUNET_CONTAINER_multishortmap_get (connections,
- &cid->connection_of_tunnel);
+ cc = GCC_lookup (cid);
if (NULL == cc)
return; /* whopise, connection alredy down? */
GNUNET_STATISTICS_update (stats,
GCC_destroy_without_tunnel (struct CadetConnection *cc);
+/**
+ * Lookup a connection by its identifier.
+ *
+ * @param cid identifier to resolve
+ * @return NULL if connection was not found
+ */
+struct CadetConnection *
+GCC_lookup (const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid);
+
+
/**
* Create a connection to @a destination via @a path and
* notify @a cb whenever we are ready for more data.
struct CadetPeerPath *path;
struct CadetPeer *origin;
- cc = GNUNET_CONTAINER_multishortmap_get (connections,
- &msg->cid.connection_of_tunnel);
+ cc = GCC_lookup (&msg->cid);
if (NULL != cc)
{
LOG (GNUNET_ERROR_TYPE_DEBUG,
struct CadetConnection *cc;
/* First, check if ACK belongs to a connection that ends here. */
- cc = GNUNET_CONTAINER_multishortmap_get (connections,
- &msg->cid.connection_of_tunnel);
+ cc = GCC_lookup (&msg->cid);
if (NULL != cc)
{
/* verify ACK came from the right direction */
struct CadetRoute *route;
/* First, check if message belongs to a connection that ends here. */
- cc = GNUNET_CONTAINER_multishortmap_get (connections,
- &msg->cid.connection_of_tunnel);
+ cc = GCC_lookup (&msg->cid);
if (NULL != cc)
{
/* verify message came from the right direction */
struct CadetRoute *route;
/* First, check if message belongs to a connection that ends here. */
- cc = GNUNET_CONTAINER_multishortmap_get (connections,
- &msg->cid.connection_of_tunnel);
+ cc = GCC_lookup (&msg->cid);
if (NULL != cc)
{
/* verify message came from the right direction */
struct CadetConnection *cc;
/* First, check if message belongs to a connection that ends here. */
- cc = GNUNET_CONTAINER_multishortmap_get (connections,
- &msg->cid.connection_of_tunnel);
+ cc = GCC_lookup (&msg->cid);
if (NULL != cc)
{
/* verify message came from the right direction */
struct CadetConnection *cc;
/* First, check if message belongs to a connection that ends here. */
- cc = GNUNET_CONTAINER_multishortmap_get (connections,
- &msg->kx.cid.connection_of_tunnel);
+ cc = GCC_lookup (&msg->kx.cid);
if (NULL != cc)
{
/* verify message came from the right direction */
struct CadetConnection *cc;
/* First, check if message belongs to a connection that ends here. */
- cc = GNUNET_CONTAINER_multishortmap_get (connections,
- &msg->cid.connection_of_tunnel);
+ cc = GCC_lookup (&msg->cid);
if (NULL != cc)
{
/* verify message came from the right direction */