uint32_t ats_count;
/**
- * Bandwidth assigned to this address right now, 0 for none.
+ * Inbound bandwidth assigned to this address right now, 0 for none.
*/
- struct GNUNET_BANDWIDTH_Value32NBO bandwidth;
+ struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in;
+
+ /**
+ * Outbound bandwidth assigned to this address right now, 0 for none.
+ */
+ struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out;
/**
* Set to GNUNET_YES if this is the connected address of a connected peer.
GNUNET_SCHEDULER_TaskIdentifier ba_task;
/**
- * Total bandwidth per configuration.
+ * Total inbound bandwidth per configuration.
+ */
+ unsigned long long total_bps_in;
+
+ /**
+ * Total outbound bandwidth per configuration.
*/
- unsigned long long total_bps;
+ unsigned long long total_bps_out;
};
struct GNUNET_ATS_Handle *atc;
/**
- * Bandwidth to assign.
+ * Inbound bandwidth to assign.
*/
- struct GNUNET_BANDWIDTH_Value32NBO bw;
+ struct GNUNET_BANDWIDTH_Value32NBO bw_in;
+
+ /**
+ * Outbound bandwidth to assign.
+ */
+ struct GNUNET_BANDWIDTH_Value32NBO bw_out;
};
if (GNUNET_YES == ar->connected)
{
- ar->bandwidth = sbc->bw;
+ ar->bandwidth_in = sbc->bw_in;
+ ar->bandwidth_out = sbc->bw_out;
sbc->atc->alloc_cb (sbc->atc->alloc_cb_cls,
(const struct GNUNET_PeerIdentity *) key,
ar->plugin_name, ar->session, ar->plugin_addr,
- ar->plugin_addr_len, ar->bandwidth);
+ ar->plugin_addr_len, ar->bandwidth_out, ar->bandwidth_in);
}
- else if (ntohl (ar->bandwidth.value__) > 0)
+ else if (ntohl (ar->bandwidth_out.value__) > 0)
{
- ar->bandwidth = GNUNET_BANDWIDTH_value_init (0);
+ ar->bandwidth_in = GNUNET_BANDWIDTH_value_init (0);
+ ar->bandwidth_out = GNUNET_BANDWIDTH_value_init (0);
sbc->atc->alloc_cb (sbc->atc->alloc_cb_cls,
(const struct GNUNET_PeerIdentity *) key,
ar->plugin_name, ar->session, ar->plugin_addr,
- ar->plugin_addr_len, ar->bandwidth);
+ ar->plugin_addr_len, ar->bandwidth_out, ar->bandwidth_in);
}
return GNUNET_YES;
}
if (ac == 0)
ac++;
GNUNET_assert (ac > 0);
- bwc.bw = GNUNET_BANDWIDTH_value_init (atc->total_bps / ac);
+ bwc.bw_in = GNUNET_BANDWIDTH_value_init (atc->total_bps_in / ac);
+ bwc.bw_out = GNUNET_BANDWIDTH_value_init (atc->total_bps_out / ac);
GNUNET_CONTAINER_multihashmap_iterate (atc->peers, &set_bw_connections, &bwc);
}
/* trivial strategy: pick first available address... */
asc->cb (asc->cb_cls, &asc->target, ar->plugin_name, ar->plugin_addr,
ar->plugin_addr_len, ar->session,
- GNUNET_BANDWIDTH_value_init (asc->atc->total_bps / 32), ar->ats,
+ GNUNET_BANDWIDTH_value_init (asc->atc->total_bps_out / 32),
+ GNUNET_BANDWIDTH_value_init (asc->atc->total_bps_in / 32),
+ ar->ats,
ar->ats_count);
asc->cb = NULL;
return GNUNET_NO;
atc->peers = GNUNET_CONTAINER_multihashmap_create (256);
atc->notify_map = GNUNET_CONTAINER_multihashmap_create (256);
GNUNET_CONFIGURATION_get_value_number (cfg, "core", "TOTAL_QUOTA_OUT",
- &atc->total_bps);
+ &atc->total_bps_out);
+ GNUNET_CONFIGURATION_get_value_number (cfg, "core", "TOTAL_QUOTA_IN",
+ &atc->total_bps_in);
return atc;
}
asc->cb (asc->cb_cls, &asc->target, ar->plugin_name, ar->plugin_addr,
ar->plugin_addr_len, ar->session,
- GNUNET_BANDWIDTH_value_init (asc->atc->total_bps / 32), ar->ats,
- ar->ats_count);
+ GNUNET_BANDWIDTH_value_init (asc->atc->total_bps_out / 32),
+ GNUNET_BANDWIDTH_value_init (asc->atc->total_bps_in / 32),
+ ar->ats, ar->ats_count);
GNUNET_ATS_suggest_address_cancel (asc);
asc = NULL;
return GNUNET_OK;
* @param session session to use (if available)
* @param plugin_addr address to use (if available)
* @param plugin_addr_len number of bytes in addr
- * @param bandwidth assigned outbound bandwidth for the connection
+ * @param bandwidth_out assigned outbound bandwidth for the connection
+ * @param bandwidth_in assigned inbound bandwidth for the connection
*/
typedef void (*GNUNET_TRANSPORT_ATS_AllocationNotification) (void *cls,
const struct
plugin_addr_len,
struct
GNUNET_BANDWIDTH_Value32NBO
- bandwidth);
+ bandwidth_out,
+ struct
+ GNUNET_BANDWIDTH_Value32NBO
+ bandwidth_in);
/**
* @param plugin_name name of the plugin, NULL if we have no suggestion
* @param plugin_addr suggested address, NULL if we have no suggestion
* @param plugin_addr_len number of bytes in plugin_addr
- * @param bandwidth assigned outbound bandwidth for the connection
+ * @param bandwidth_out assigned outbound bandwidth for the connection
+ * @param bandwidth_in assigned inbound bandwidth for the connection
* @param ats performance data for the address (as far as known)
* @param ats_count number of performance records in 'ats'
*/
struct Session * session,
struct
GNUNET_BANDWIDTH_Value32NBO
- bandwidth,
+ bandwidth_out,
+ struct
+ GNUNET_BANDWIDTH_Value32NBO
+ bandwidth_in,
const struct
GNUNET_TRANSPORT_ATS_Information
* ats,
* @param session session to use (if available)
* @param plugin_addr address to use (if available)
* @param plugin_addr_len number of bytes in addr
- * @param bandwidth assigned outbound bandwidth for the connection
+ * @param bandwidth_out assigned outbound bandwidth for the connection
+ * @param bandwidth_in assigned inbound bandwidth for the connection
*/
static void
ats_request_address_change (void *cls, const struct GNUNET_PeerIdentity *peer,
const char *plugin_name, struct Session *session,
const void *plugin_addr, size_t plugin_addr_len,
- struct GNUNET_BANDWIDTH_Value32NBO bandwidth)
+ struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
+ struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
{
GST_neighbours_switch_to_address (peer, plugin_name, plugin_addr,
plugin_addr_len, session, NULL, 0);
- GST_neighbours_set_incoming_quota (peer, bandwidth);
+ GST_neighbours_set_incoming_quota (peer, bandwidth_in);
+ // FIXME: use 'bandwidth_out'!
}
* @param plugin_address binary address
* @param plugin_address_len length of address
* @param session session to use
- * @param bandwidth available bandwidth
+ * @param bandwidth_out available outbound bandwidth
+ * @param bandwidth_in available inbound bandwidth
* @param ats performance data for the address (as far as known)
* @param ats_count number of performance records in 'ats'
*/
try_connect_using_address (void *cls, const struct GNUNET_PeerIdentity *target,
const char *plugin_name, const void *plugin_address,
size_t plugin_address_len, struct Session *session,
- struct GNUNET_BANDWIDTH_Value32NBO bandwidth,
+ struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
+ struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
const struct GNUNET_TRANSPORT_ATS_Information *ats,
uint32_t ats_count)
{