[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r17304 - in gnunet/src: ats include transport
From: |
gnunet |
Subject: |
[GNUnet-SVN] r17304 - in gnunet/src: ats include transport |
Date: |
Mon, 10 Oct 2011 12:39:43 +0200 |
Author: grothoff
Date: 2011-10-10 12:39:43 +0200 (Mon, 10 Oct 2011)
New Revision: 17304
Modified:
gnunet/src/ats/ats_api.c
gnunet/src/include/gnunet_ats_service.h
gnunet/src/transport/gnunet-service-transport.c
gnunet/src/transport/gnunet-service-transport_neighbours.c
Log:
ATS API: do inbound and outbound bw
Modified: gnunet/src/ats/ats_api.c
===================================================================
--- gnunet/src/ats/ats_api.c 2011-10-10 10:36:47 UTC (rev 17303)
+++ gnunet/src/ats/ats_api.c 2011-10-10 10:39:43 UTC (rev 17304)
@@ -77,11 +77,16 @@
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.
*/
int connected;
@@ -156,9 +161,14 @@
GNUNET_SCHEDULER_TaskIdentifier ba_task;
/**
- * Total bandwidth per configuration.
+ * Total inbound bandwidth per configuration.
*/
- unsigned long long total_bps;
+ unsigned long long total_bps_in;
+
+ /**
+ * Total outbound bandwidth per configuration.
+ */
+ unsigned long long total_bps_out;
};
@@ -193,9 +203,14 @@
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;
};
@@ -215,19 +230,21 @@
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;
}
@@ -253,7 +270,8 @@
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);
}
@@ -296,7 +314,9 @@
/* 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;
@@ -392,7 +412,9 @@
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;
}
@@ -767,8 +789,9 @@
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;
Modified: gnunet/src/include/gnunet_ats_service.h
===================================================================
--- gnunet/src/include/gnunet_ats_service.h 2011-10-10 10:36:47 UTC (rev
17303)
+++ gnunet/src/include/gnunet_ats_service.h 2011-10-10 10:39:43 UTC (rev
17304)
@@ -56,7 +56,8 @@
* @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
@@ -72,7 +73,10 @@
plugin_addr_len,
struct
GNUNET_BANDWIDTH_Value32NBO
- bandwidth);
+ bandwidth_out,
+ struct
+
GNUNET_BANDWIDTH_Value32NBO
+ bandwidth_in);
/**
@@ -106,7 +110,8 @@
* @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'
*/
@@ -120,7 +125,10 @@
struct Session * session,
struct
GNUNET_BANDWIDTH_Value32NBO
- bandwidth,
+ bandwidth_out,
+ struct
+
GNUNET_BANDWIDTH_Value32NBO
+ bandwidth_in,
const struct
GNUNET_TRANSPORT_ATS_Information
* ats,
Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c 2011-10-10 10:36:47 UTC
(rev 17303)
+++ gnunet/src/transport/gnunet-service-transport.c 2011-10-10 10:39:43 UTC
(rev 17304)
@@ -322,17 +322,20 @@
* @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'!
}
Modified: gnunet/src/transport/gnunet-service-transport_neighbours.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_neighbours.c 2011-10-10
10:36:47 UTC (rev 17303)
+++ gnunet/src/transport/gnunet-service-transport_neighbours.c 2011-10-10
10:39:43 UTC (rev 17304)
@@ -702,7 +702,8 @@
* @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'
*/
@@ -710,7 +711,8 @@
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)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r17304 - in gnunet/src: ats include transport,
gnunet <=