[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r35149 - in gnunet/src: ats ats-tests include transport
From: |
gnunet |
Subject: |
[GNUnet-SVN] r35149 - in gnunet/src: ats ats-tests include transport |
Date: |
Sun, 8 Feb 2015 12:46:36 +0100 |
Author: grothoff
Date: 2015-02-08 12:46:36 +0100 (Sun, 08 Feb 2015)
New Revision: 35149
Modified:
gnunet/src/ats-tests/ats-testing.c
gnunet/src/ats/ats_api_scanner.c
gnunet/src/ats/gnunet-service-ats_normalization.c
gnunet/src/ats/plugin_ats_mlp.c
gnunet/src/include/gnunet_ats_service.h
gnunet/src/transport/gnunet-service-transport.c
gnunet/src/transport/gnunet-service-transport_clients.c
gnunet/src/transport/gnunet-service-transport_neighbours.c
gnunet/src/transport/gnunet-service-transport_neighbours.h
Log:
more dead and duplicate code elimination
Modified: gnunet/src/ats/ats_api_scanner.c
===================================================================
--- gnunet/src/ats/ats_api_scanner.c 2015-02-08 11:45:04 UTC (rev 35148)
+++ gnunet/src/ats/ats_api_scanner.c 2015-02-08 11:46:36 UTC (rev 35149)
@@ -78,23 +78,14 @@
return "UTILIZATION_UP";
case GNUNET_ATS_UTILIZATION_IN:
return "UTILIZATION_DOWN";
- case GNUNET_ATS_UTILIZATION_PAYLOAD_OUT:
- return "UTILIZATION_PAYLOAD_UP";
- case GNUNET_ATS_UTILIZATION_PAYLOAD_IN:
- return "UTILIZATION_PAYLOAD_DOWN";
case GNUNET_ATS_NETWORK_TYPE:
return "NETWORK_TYPE";
case GNUNET_ATS_QUALITY_NET_DELAY:
return "DELAY";
case GNUNET_ATS_QUALITY_NET_DISTANCE:
return "DISTANCE";
- case GNUNET_ATS_COST_WAN:
- return "COST_WAN";
- case GNUNET_ATS_COST_LAN:
- return "COST_LAN";
- case GNUNET_ATS_COST_WLAN:
- return "COST_WLAN";
default:
+ GNUNET_break (0);
return NULL;
}
}
Modified: gnunet/src/ats/gnunet-service-ats_normalization.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_normalization.c 2015-02-08 11:45:04 UTC
(rev 35148)
+++ gnunet/src/ats/gnunet-service-ats_normalization.c 2015-02-08 11:46:36 UTC
(rev 35149)
@@ -324,7 +324,7 @@
/* Normalize the values of this property */
if (GNUNET_NO == limits_changed)
{
- /* normalize just this address */
+ /* normalize just this address */
normalize_address (p,
&address->peer,
address);
Modified: gnunet/src/ats/plugin_ats_mlp.c
===================================================================
--- gnunet/src/ats/plugin_ats_mlp.c 2015-02-08 11:45:04 UTC (rev 35148)
+++ gnunet/src/ats/plugin_ats_mlp.c 2015-02-08 11:46:36 UTC (rev 35149)
@@ -597,45 +597,6 @@
/**
- * Translate ATS properties to text
- * Just intended for debugging
- *
- * @param ats_index the ATS index
- * @return string with result
- */
-static const char *
-mlp_ats_to_string (int ats_index)
-{
- switch (ats_index) {
- case GNUNET_ATS_ARRAY_TERMINATOR:
- return "GNUNET_ATS_ARRAY_TERMINATOR";
- case GNUNET_ATS_UTILIZATION_OUT:
- return "GNUNET_ATS_UTILIZATION_OUT";
- case GNUNET_ATS_UTILIZATION_IN:
- return "GNUNET_ATS_UTILIZATION_IN";
- case GNUNET_ATS_UTILIZATION_PAYLOAD_OUT:
- return "GNUNET_ATS_UTILIZATION_PAYLOAD_OUT";
- case GNUNET_ATS_UTILIZATION_PAYLOAD_IN:
- return "GNUNET_ATS_UTILIZATION_PAYLOAD_IN";
- case GNUNET_ATS_COST_LAN:
- return "GNUNET_ATS_COST_LAN";
- case GNUNET_ATS_COST_WAN:
- return "GNUNET_ATS_COST_LAN";
- case GNUNET_ATS_COST_WLAN:
- return "GNUNET_ATS_COST_WLAN";
- case GNUNET_ATS_NETWORK_TYPE:
- return "GNUNET_ATS_NETWORK_TYPE";
- case GNUNET_ATS_QUALITY_NET_DELAY:
- return "GNUNET_ATS_QUALITY_NET_DELAY";
- case GNUNET_ATS_QUALITY_NET_DISTANCE:
- return "GNUNET_ATS_QUALITY_NET_DISTANCE";
- default:
- GNUNET_break (0);
- return "unknown";
- }
-}
-
-/**
* Translate glpk status error codes to text
* @param retcode return code
* @return string with result
@@ -1217,7 +1178,8 @@
{
for (c = 0; c < mlp->pv.m_q; c++)
{
- GNUNET_asprintf(&name, "c7_q%i_%s", c,
mlp_ats_to_string(mlp->pv.q[c]));
+ GNUNET_asprintf (&name, "c7_q%i_%s", c,
+ GNUNET_ATS_print_property_type (mlp->pv.q[c]));
p->r_q[c] = mlp_create_problem_create_constraint (p, name, GLP_FX,
0.0, 0.0);
GNUNET_free (name);
mlp_create_problem_set_value (p, p->r_q[c], p->c_q[c], -1, __LINE__);
Modified: gnunet/src/ats-tests/ats-testing.c
===================================================================
--- gnunet/src/ats-tests/ats-testing.c 2015-02-08 11:45:04 UTC (rev 35148)
+++ gnunet/src/ats-tests/ats-testing.c 2015-02-08 11:46:36 UTC (rev 35149)
@@ -613,21 +613,6 @@
p->ats_distance = ntohl (ats[c_a].value);
GNUNET_break (0);
break;
- case GNUNET_ATS_COST_WAN:
- if (p->ats_cost_wan != ntohl (ats[c_a].value))
- log = GNUNET_YES;
- p->ats_cost_wan = ntohl (ats[c_a].value);
- break;
- case GNUNET_ATS_COST_LAN:
- if (p->ats_cost_lan != ntohl (ats[c_a].value))
- log = GNUNET_YES;
- p->ats_cost_lan = ntohl (ats[c_a].value);
- break;
- case GNUNET_ATS_COST_WLAN:
- if (p->ats_cost_wlan != ntohl (ats[c_a].value))
- log = GNUNET_YES;
- p->ats_cost_wlan = ntohl (ats[c_a].value);
- break;
default:
break;
}
Modified: gnunet/src/include/gnunet_ats_service.h
===================================================================
--- gnunet/src/include/gnunet_ats_service.h 2015-02-08 11:45:04 UTC (rev
35148)
+++ gnunet/src/include/gnunet_ats_service.h 2015-02-08 11:46:36 UTC (rev
35149)
@@ -98,12 +98,7 @@
*/
#define GNUNET_ATS_MaxBandwidthString "unlimited"
-/**
- * Number of property types supported by ATS
- */
-#define GNUNET_ATS_PropertyCount 11
-
/**
* Enum defining all known property types for ATS Enum values are used
* in the GNUNET_ATS_Information struct as
@@ -129,7 +124,7 @@
*
* Unit: [bytes/second]
*/
- GNUNET_ATS_UTILIZATION_OUT,
+ GNUNET_ATS_UTILIZATION_OUT = 1,
/**
* Actual traffic on this connection from the other peer to this peer.
@@ -137,29 +132,13 @@
*
* Unit: [bytes/second]
*/
- GNUNET_ATS_UTILIZATION_IN,
+ GNUNET_ATS_UTILIZATION_IN = 2,
/**
- * Actual traffic on this connection from this peer to the other peer.
- * Only payload from layers > transport
- *
- * Unit: [bytes/second]
- */
- GNUNET_ATS_UTILIZATION_PAYLOAD_OUT,
-
- /**
- * Actual traffic on this connection from the other peer to this peer.
- * Only payload from layers > transport
- *
- * Unit: [bytes/second]
- */
- GNUNET_ATS_UTILIZATION_PAYLOAD_IN,
-
- /**
* Is this address located in WAN, LAN or a loopback address
* Value is element of GNUNET_ATS_Network_Type
*/
- GNUNET_ATS_NETWORK_TYPE,
+ GNUNET_ATS_NETWORK_TYPE = 3,
/**
* Delay
@@ -173,78 +152,21 @@
* WLAN : 2
* Dialup: 500
*/
- GNUNET_ATS_QUALITY_NET_DELAY,
+ GNUNET_ATS_QUALITY_NET_DELAY = 4,
/**
* Distance on network layer (required for distance-vector routing).
*
* Unit: [DV-hops]
*/
- GNUNET_ATS_QUALITY_NET_DISTANCE,
+ GNUNET_ATS_QUALITY_NET_DISTANCE = 5
- /**
- * Network overhead on WAN (Wide-Area Network)
- *
- * How many bytes are sent on the WAN when 1 kilobyte (1024 bytes)
- * of application data is transmitted?
- * A factor used with connect cost, bandwidth cost and energy cost
- * to describe the overhead produced by the transport protocol
- *
- * Unit: [bytes/kb]
- *
- * Interpretation: less is better
- *
- * Examples:
- *
- * TCP/IPv4 over Ethernet: 1024 + 38 + 20 + 20 = 1102 [bytes/kb]
- * TCP/IPv6 over Ethernet: 1024 + 38 + 20 + 40 = 1122 [bytes/kb]
- * UDP/IPv4 over Ethernet: 1024 + 38 + 20 + 8 = 1090 [bytes/kb]
- * UDP/IPv6 over Ethernet: 1024 + 38 + 40 + 8 = 1110 [bytes/kb]
- */
- GNUNET_ATS_COST_WAN,
+/**
+ * Number of property types supported by ATS
+ */
+#define GNUNET_ATS_PropertyCount 6
- /**
- * Network overhead on LAN (Local-Area Network)
- *
- * How many bytes are sent on the LAN when 1 kilobyte (1024 bytes)
- * of application data is transmitted?
- * A factor used with connect cost, bandwidth cost and energy cost
- * to describe the overhead produced by the transport protocol
- *
- * Unit: [bytes/kb]
- *
- * Interpretation: less is better
- *
- * Examples:
- *
- * TCP/IPv4 over Ethernet: 1024 + 38 + 20 + 20 = 1102 [bytes/kb]
- * TCP/IPv6 over Ethernet: 1024 + 38 + 20 + 40 = 1122 [bytes/kb]
- * UDP/IPv4 over Ethernet: 1024 + 38 + 20 + 8 = 1090 [bytes/kb]
- * UDP/IPv6 over Ethernet: 1024 + 38 + 40 + 8 = 1110 [bytes/kb]
- */
- GNUNET_ATS_COST_LAN,
- /**
- * Network overhead on WLAN (Wireless Local Area Network)
- *
- * How many bytes are sent on the LAN when 1 kilobyte (1024 bytes)
- * of application data is transmitted?
- * A factor used with connect cost, bandwidth cost and energy cost
- * to describe the overhead produced by the transport protocol
- *
- * Unit: [bytes/kb]
- *
- * Interpretation: less is better
- *
- * Examples:
- *
- * TCP/IPv4 over Ethernet: 1024 + 38 + 20 + 20 = 1102 [bytes/kb]
- * TCP/IPv6 over Ethernet: 1024 + 38 + 20 + 40 = 1122 [bytes/kb]
- * UDP/IPv4 over Ethernet: 1024 + 38 + 20 + 8 = 1090 [bytes/kb]
- * UDP/IPv6 over Ethernet: 1024 + 38 + 40 + 8 = 1110 [bytes/kb]
- */
- GNUNET_ATS_COST_WLAN
-
};
Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c 2015-02-08 11:45:04 UTC
(rev 35148)
+++ gnunet/src/transport/gnunet-service-transport.c 2015-02-08 11:46:36 UTC
(rev 35149)
@@ -576,8 +576,6 @@
gettext_noop ("# bytes payload received"),
ntohs (message->size),
GNUNET_NO);
- GST_neighbours_notify_payload_recv (address,
- message);
ret = process_payload (address,
session,
message);
Modified: gnunet/src/transport/gnunet-service-transport_clients.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_clients.c 2015-02-08
11:45:04 UTC (rev 35148)
+++ gnunet/src/transport/gnunet-service-transport_clients.c 2015-02-08
11:46:36 UTC (rev 35149)
@@ -700,9 +700,6 @@
struct SendTransmitContinuationContext *stcc = cls;
struct SendOkMessage send_ok_msg;
- if (GNUNET_OK == success)
- GST_neighbours_notify_payload_sent (&stcc->target,
- bytes_payload);
send_ok_msg.header.size = htons (sizeof (send_ok_msg));
send_ok_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_OK);
send_ok_msg.bytes_msg = htonl (bytes_payload);
Modified: gnunet/src/transport/gnunet-service-transport_neighbours.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_neighbours.c 2015-02-08
11:45:04 UTC (rev 35148)
+++ gnunet/src/transport/gnunet-service-transport_neighbours.c 2015-02-08
11:46:36 UTC (rev 35149)
@@ -415,16 +415,6 @@
/**
* Tracking utilization of outbound bandwidth
*/
- uint32_t util_payload_bytes_sent;
-
- /**
- * Tracking utilization of inbound bandwidth
- */
- uint32_t util_payload_bytes_recv;
-
- /**
- * Tracking utilization of outbound bandwidth
- */
uint32_t util_total_bytes_sent;
/**
@@ -2840,8 +2830,6 @@
{
struct NeighbourMapEntry *n = value;
struct GNUNET_ATS_Information atsi[4];
- uint32_t bps_pl_in;
- uint32_t bps_pl_out;
uint32_t bps_in;
uint32_t bps_out;
struct GNUNET_TIME_Relative delta;
@@ -2850,19 +2838,6 @@
return GNUNET_OK;
delta = GNUNET_TIME_absolute_get_difference (n->last_util_transmission,
GNUNET_TIME_absolute_get ());
-
- bps_pl_in = 0;
-
- if ((0 != n->util_payload_bytes_recv) && (0 != delta.rel_value_us))
- bps_pl_in = (1000LL * 1000LL * n->util_payload_bytes_recv) /
(delta.rel_value_us);
- bps_pl_out = 0;
- if ((0 != n->util_payload_bytes_sent) && (0 != delta.rel_value_us))
- bps_pl_out = (1000LL * 1000LL * n->util_payload_bytes_sent) /
delta.rel_value_us;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "`%s' payload: received %u Bytes/s, sent %u Bytes/s\n",
- GNUNET_i2s (key),
- bps_pl_in,
- bps_pl_out);
bps_in = 0;
if ((0 != n->util_total_bytes_recv) && (0 != delta.rel_value_us))
bps_in = (1000LL * 1000LL * n->util_total_bytes_recv) /
(delta.rel_value_us);
@@ -2880,17 +2855,9 @@
atsi[0].value = htonl (bps_out);
atsi[1].type = htonl (GNUNET_ATS_UTILIZATION_IN);
atsi[1].value = htonl (bps_in);
-
- atsi[2].type = htonl (GNUNET_ATS_UTILIZATION_PAYLOAD_OUT);
- atsi[2].value = htonl (bps_pl_out);
- atsi[3].type = htonl (GNUNET_ATS_UTILIZATION_PAYLOAD_IN);
- atsi[3].value = htonl (bps_pl_in);
-
GST_ats_update_metrics (n->primary_address.address,
n->primary_address.session,
- atsi, 4);
- n->util_payload_bytes_recv = 0;
- n->util_payload_bytes_sent = 0;
+ atsi, 2);
n->util_total_bytes_recv = 0;
n->util_total_bytes_sent = 0;
n->last_util_transmission = GNUNET_TIME_absolute_get ();
@@ -2941,27 +2908,6 @@
/**
- * Track information about payload (useful data) we received from the
- * given address (used to notify ATS about our utilization of
- * allocated resources).
- *
- * @param address the address we got data from
- * @param message the message we received (really only the size is used)
- */
-void
-GST_neighbours_notify_payload_recv (const struct GNUNET_HELLO_Address *address,
- const struct GNUNET_MessageHeader *message)
-{
- struct NeighbourMapEntry *n;
-
- n = lookup_neighbour (&address->peer);
- if (NULL == n)
- return;
- n->util_payload_bytes_recv += ntohs (message->size);
-}
-
-
-/**
* Track information about data we transmitted using the given @a
* address and @a session (used to notify ATS about our utilization of
* allocated resources).
@@ -2987,27 +2933,6 @@
/**
- * Track information about payload (useful data) we transmitted using the
- * given address (used to notify ATS about our utilization of
- * allocated resources).
- *
- * @param address the address we transmitted data to
- * @param message the message we sent (really only the size is used)
- */
-void
-GST_neighbours_notify_payload_sent (const struct GNUNET_PeerIdentity *peer,
- size_t size)
-{
- struct NeighbourMapEntry *n;
-
- n = lookup_neighbour (peer);
- if (NULL == n)
- return;
- n->util_payload_bytes_sent += size;
-}
-
-
-/**
* Master task run for every neighbour. Performs all of the time-related
* activities (keep alive, send next message, disconnect if idle, finish
* clean up after disconnect).
Modified: gnunet/src/transport/gnunet-service-transport_neighbours.h
===================================================================
--- gnunet/src/transport/gnunet-service-transport_neighbours.h 2015-02-08
11:45:04 UTC (rev 35148)
+++ gnunet/src/transport/gnunet-service-transport_neighbours.h 2015-02-08
11:46:36 UTC (rev 35149)
@@ -222,19 +222,6 @@
/**
- * Track information about payload (useful data) we received from the
- * given address (used to notify ATS about our utilization of
- * allocated resources).
- *
- * @param address the address we got data from
- * @param message the message we received (really only the size is used)
- */
-void
-GST_neighbours_notify_payload_recv (const struct GNUNET_HELLO_Address *address,
- const struct GNUNET_MessageHeader
*message);
-
-
-/**
* Track information about data we transmitted using the given @a
* address and @a session (used to notify ATS about our utilization of
* allocated resources).
@@ -250,20 +237,6 @@
/**
- * Track information about payload (useful data) we transmitted using the
- * given address (used to notify ATS about our utilization of
- * allocated resources).
- *
- * @param address the address we transmitted data to
- * @param message the message we sent (really only the size is used)
- */
-void
-GST_neighbours_notify_payload_sent (const struct GNUNET_PeerIdentity *peer,
- size_t size);
-
-
-
-/**
* For an existing neighbour record, set the active connection to
* use the given address.
*
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r35149 - in gnunet/src: ats ats-tests include transport,
gnunet <=