aboutsummaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-02-08 11:46:36 +0000
committerChristian Grothoff <christian@grothoff.org>2015-02-08 11:46:36 +0000
commit6115a1150c65bd4a33ed61c6e96594c4a73d86ac (patch)
treef2bb2a57f540a3799cd112b5235f1c4222fd283e /src/transport
parentcd0a6e382eafd7fd241a00a10527333d73985fca (diff)
downloadgnunet-6115a1150c65bd4a33ed61c6e96594c4a73d86ac.tar.gz
gnunet-6115a1150c65bd4a33ed61c6e96594c4a73d86ac.zip
more dead and duplicate code elimination
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/gnunet-service-transport.c2
-rw-r--r--src/transport/gnunet-service-transport_clients.c3
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c77
-rw-r--r--src/transport/gnunet-service-transport_neighbours.h27
4 files changed, 1 insertions, 108 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index 3746f0597..336925f4f 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -576,8 +576,6 @@ GST_receive_callback (void *cls,
576 gettext_noop ("# bytes payload received"), 576 gettext_noop ("# bytes payload received"),
577 ntohs (message->size), 577 ntohs (message->size),
578 GNUNET_NO); 578 GNUNET_NO);
579 GST_neighbours_notify_payload_recv (address,
580 message);
581 ret = process_payload (address, 579 ret = process_payload (address,
582 session, 580 session,
583 message); 581 message);
diff --git a/src/transport/gnunet-service-transport_clients.c b/src/transport/gnunet-service-transport_clients.c
index 0aef9f97e..8e0b3fe68 100644
--- a/src/transport/gnunet-service-transport_clients.c
+++ b/src/transport/gnunet-service-transport_clients.c
@@ -700,9 +700,6 @@ handle_send_transmit_continuation (void *cls,
700 struct SendTransmitContinuationContext *stcc = cls; 700 struct SendTransmitContinuationContext *stcc = cls;
701 struct SendOkMessage send_ok_msg; 701 struct SendOkMessage send_ok_msg;
702 702
703 if (GNUNET_OK == success)
704 GST_neighbours_notify_payload_sent (&stcc->target,
705 bytes_payload);
706 send_ok_msg.header.size = htons (sizeof (send_ok_msg)); 703 send_ok_msg.header.size = htons (sizeof (send_ok_msg));
707 send_ok_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_OK); 704 send_ok_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_OK);
708 send_ok_msg.bytes_msg = htonl (bytes_payload); 705 send_ok_msg.bytes_msg = htonl (bytes_payload);
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index 750e1a793..15bb0bdab 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -415,16 +415,6 @@ struct NeighbourMapEntry
415 /** 415 /**
416 * Tracking utilization of outbound bandwidth 416 * Tracking utilization of outbound bandwidth
417 */ 417 */
418 uint32_t util_payload_bytes_sent;
419
420 /**
421 * Tracking utilization of inbound bandwidth
422 */
423 uint32_t util_payload_bytes_recv;
424
425 /**
426 * Tracking utilization of outbound bandwidth
427 */
428 uint32_t util_total_bytes_sent; 418 uint32_t util_total_bytes_sent;
429 419
430 /** 420 /**
@@ -2840,8 +2830,6 @@ send_utilization_data (void *cls,
2840{ 2830{
2841 struct NeighbourMapEntry *n = value; 2831 struct NeighbourMapEntry *n = value;
2842 struct GNUNET_ATS_Information atsi[4]; 2832 struct GNUNET_ATS_Information atsi[4];
2843 uint32_t bps_pl_in;
2844 uint32_t bps_pl_out;
2845 uint32_t bps_in; 2833 uint32_t bps_in;
2846 uint32_t bps_out; 2834 uint32_t bps_out;
2847 struct GNUNET_TIME_Relative delta; 2835 struct GNUNET_TIME_Relative delta;
@@ -2850,19 +2838,6 @@ send_utilization_data (void *cls,
2850 return GNUNET_OK; 2838 return GNUNET_OK;
2851 delta = GNUNET_TIME_absolute_get_difference (n->last_util_transmission, 2839 delta = GNUNET_TIME_absolute_get_difference (n->last_util_transmission,
2852 GNUNET_TIME_absolute_get ()); 2840 GNUNET_TIME_absolute_get ());
2853
2854 bps_pl_in = 0;
2855
2856 if ((0 != n->util_payload_bytes_recv) && (0 != delta.rel_value_us))
2857 bps_pl_in = (1000LL * 1000LL * n->util_payload_bytes_recv) / (delta.rel_value_us);
2858 bps_pl_out = 0;
2859 if ((0 != n->util_payload_bytes_sent) && (0 != delta.rel_value_us))
2860 bps_pl_out = (1000LL * 1000LL * n->util_payload_bytes_sent) / delta.rel_value_us;
2861 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2862 "`%s' payload: received %u Bytes/s, sent %u Bytes/s\n",
2863 GNUNET_i2s (key),
2864 bps_pl_in,
2865 bps_pl_out);
2866 bps_in = 0; 2841 bps_in = 0;
2867 if ((0 != n->util_total_bytes_recv) && (0 != delta.rel_value_us)) 2842 if ((0 != n->util_total_bytes_recv) && (0 != delta.rel_value_us))
2868 bps_in = (1000LL * 1000LL * n->util_total_bytes_recv) / (delta.rel_value_us); 2843 bps_in = (1000LL * 1000LL * n->util_total_bytes_recv) / (delta.rel_value_us);
@@ -2880,17 +2855,9 @@ send_utilization_data (void *cls,
2880 atsi[0].value = htonl (bps_out); 2855 atsi[0].value = htonl (bps_out);
2881 atsi[1].type = htonl (GNUNET_ATS_UTILIZATION_IN); 2856 atsi[1].type = htonl (GNUNET_ATS_UTILIZATION_IN);
2882 atsi[1].value = htonl (bps_in); 2857 atsi[1].value = htonl (bps_in);
2883
2884 atsi[2].type = htonl (GNUNET_ATS_UTILIZATION_PAYLOAD_OUT);
2885 atsi[2].value = htonl (bps_pl_out);
2886 atsi[3].type = htonl (GNUNET_ATS_UTILIZATION_PAYLOAD_IN);
2887 atsi[3].value = htonl (bps_pl_in);
2888
2889 GST_ats_update_metrics (n->primary_address.address, 2858 GST_ats_update_metrics (n->primary_address.address,
2890 n->primary_address.session, 2859 n->primary_address.session,
2891 atsi, 4); 2860 atsi, 2);
2892 n->util_payload_bytes_recv = 0;
2893 n->util_payload_bytes_sent = 0;
2894 n->util_total_bytes_recv = 0; 2861 n->util_total_bytes_recv = 0;
2895 n->util_total_bytes_sent = 0; 2862 n->util_total_bytes_sent = 0;
2896 n->last_util_transmission = GNUNET_TIME_absolute_get (); 2863 n->last_util_transmission = GNUNET_TIME_absolute_get ();
@@ -2941,27 +2908,6 @@ GST_neighbours_notify_data_recv (const struct GNUNET_HELLO_Address *address,
2941 2908
2942 2909
2943/** 2910/**
2944 * Track information about payload (useful data) we received from the
2945 * given address (used to notify ATS about our utilization of
2946 * allocated resources).
2947 *
2948 * @param address the address we got data from
2949 * @param message the message we received (really only the size is used)
2950 */
2951void
2952GST_neighbours_notify_payload_recv (const struct GNUNET_HELLO_Address *address,
2953 const struct GNUNET_MessageHeader *message)
2954{
2955 struct NeighbourMapEntry *n;
2956
2957 n = lookup_neighbour (&address->peer);
2958 if (NULL == n)
2959 return;
2960 n->util_payload_bytes_recv += ntohs (message->size);
2961}
2962
2963
2964/**
2965 * Track information about data we transmitted using the given @a 2911 * Track information about data we transmitted using the given @a
2966 * address and @a session (used to notify ATS about our utilization of 2912 * address and @a session (used to notify ATS about our utilization of
2967 * allocated resources). 2913 * allocated resources).
@@ -2987,27 +2933,6 @@ GST_neighbours_notify_data_sent (const struct GNUNET_HELLO_Address *address,
2987 2933
2988 2934
2989/** 2935/**
2990 * Track information about payload (useful data) we transmitted using the
2991 * given address (used to notify ATS about our utilization of
2992 * allocated resources).
2993 *
2994 * @param address the address we transmitted data to
2995 * @param message the message we sent (really only the size is used)
2996 */
2997void
2998GST_neighbours_notify_payload_sent (const struct GNUNET_PeerIdentity *peer,
2999 size_t size)
3000{
3001 struct NeighbourMapEntry *n;
3002
3003 n = lookup_neighbour (peer);
3004 if (NULL == n)
3005 return;
3006 n->util_payload_bytes_sent += size;
3007}
3008
3009
3010/**
3011 * Master task run for every neighbour. Performs all of the time-related 2936 * Master task run for every neighbour. Performs all of the time-related
3012 * activities (keep alive, send next message, disconnect if idle, finish 2937 * activities (keep alive, send next message, disconnect if idle, finish
3013 * clean up after disconnect). 2938 * clean up after disconnect).
diff --git a/src/transport/gnunet-service-transport_neighbours.h b/src/transport/gnunet-service-transport_neighbours.h
index 637e7609b..070ee01a9 100644
--- a/src/transport/gnunet-service-transport_neighbours.h
+++ b/src/transport/gnunet-service-transport_neighbours.h
@@ -222,19 +222,6 @@ GST_neighbours_notify_data_recv (const struct GNUNET_HELLO_Address *address,
222 222
223 223
224/** 224/**
225 * Track information about payload (useful data) we received from the
226 * given address (used to notify ATS about our utilization of
227 * allocated resources).
228 *
229 * @param address the address we got data from
230 * @param message the message we received (really only the size is used)
231 */
232void
233GST_neighbours_notify_payload_recv (const struct GNUNET_HELLO_Address *address,
234 const struct GNUNET_MessageHeader *message);
235
236
237/**
238 * Track information about data we transmitted using the given @a 225 * Track information about data we transmitted using the given @a
239 * address and @a session (used to notify ATS about our utilization of 226 * address and @a session (used to notify ATS about our utilization of
240 * allocated resources). 227 * allocated resources).
@@ -250,20 +237,6 @@ GST_neighbours_notify_data_sent (const struct GNUNET_HELLO_Address *address,
250 237
251 238
252/** 239/**
253 * Track information about payload (useful data) we transmitted using the
254 * given address (used to notify ATS about our utilization of
255 * allocated resources).
256 *
257 * @param address the address we transmitted data to
258 * @param message the message we sent (really only the size is used)
259 */
260void
261GST_neighbours_notify_payload_sent (const struct GNUNET_PeerIdentity *peer,
262 size_t size);
263
264
265
266/**
267 * For an existing neighbour record, set the active connection to 240 * For an existing neighbour record, set the active connection to
268 * use the given address. 241 * use the given address.
269 * 242 *