aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-transport_neighbours.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/gnunet-service-transport_neighbours.c')
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c49
1 files changed, 20 insertions, 29 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index 5cfb5ed6d..623712efa 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -1481,7 +1481,6 @@ GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour,
1481 struct NeighbourMapEntry *n; 1481 struct NeighbourMapEntry *n;
1482 const struct SessionKeepAliveMessage *msg; 1482 const struct SessionKeepAliveMessage *msg;
1483 struct GNUNET_TRANSPORT_PluginFunctions *papi; 1483 struct GNUNET_TRANSPORT_PluginFunctions *papi;
1484 struct GNUNET_ATS_Information ats;
1485 struct GNUNET_TIME_Relative latency; 1484 struct GNUNET_TIME_Relative latency;
1486 1485
1487 if (sizeof (struct SessionKeepAliveMessage) != ntohs (m->size)) 1486 if (sizeof (struct SessionKeepAliveMessage) != ntohs (m->size))
@@ -1524,8 +1523,9 @@ GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour,
1524 else 1523 else
1525 { 1524 {
1526 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1525 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1527 "Received keep alive response from peer `%s' for session %p\n", 1526 "Received keep alive response from peer `%s' for session %p\n",
1528 GNUNET_i2s (&n->id), n->primary_address.session); 1527 GNUNET_i2s (&n->id),
1528 n->primary_address.session);
1529 1529
1530 } 1530 }
1531 1531
@@ -1533,9 +1533,12 @@ GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour,
1533 if (NULL != (papi = GST_plugins_find (n->primary_address.address->transport_name))) 1533 if (NULL != (papi = GST_plugins_find (n->primary_address.address->transport_name)))
1534 { 1534 {
1535 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1535 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1536 "Updating session for peer `%s' for session %p\n", 1536 "Updating session for peer `%s' for session %p\n",
1537 GNUNET_i2s (&n->id), n->primary_address.session); 1537 GNUNET_i2s (&n->id),
1538 papi->update_session_timeout (papi->cls, &n->id, n->primary_address.session); 1538 n->primary_address.session);
1539 papi->update_session_timeout (papi->cls,
1540 &n->id,
1541 n->primary_address.session);
1539 } 1542 }
1540 else 1543 else
1541 { 1544 {
@@ -1554,15 +1557,8 @@ GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour,
1554 GNUNET_i2s (&n->id), 1557 GNUNET_i2s (&n->id),
1555 GNUNET_STRINGS_relative_time_to_string (latency, 1558 GNUNET_STRINGS_relative_time_to_string (latency,
1556 GNUNET_YES)); 1559 GNUNET_YES));
1557 /* append latency */ 1560 GST_ats_update_delay (n->primary_address.address,
1558 ats.type = htonl (GNUNET_ATS_QUALITY_NET_DELAY); 1561 GNUNET_TIME_relative_divide (latency, 2));
1559 ats.value = htonl ( (latency.rel_value_us > UINT32_MAX)
1560 ? UINT32_MAX
1561 : (uint32_t) latency.rel_value_us );
1562 GST_ats_update_metrics (n->primary_address.address,
1563 n->primary_address.session,
1564 &ats,
1565 1);
1566} 1562}
1567 1563
1568 1564
@@ -1579,8 +1575,9 @@ GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour,
1579 * @return how long to wait before reading more from this sender 1575 * @return how long to wait before reading more from this sender
1580 */ 1576 */
1581struct GNUNET_TIME_Relative 1577struct GNUNET_TIME_Relative
1582GST_neighbours_calculate_receive_delay (const struct GNUNET_PeerIdentity 1578GST_neighbours_calculate_receive_delay (const struct GNUNET_PeerIdentity *sender,
1583 *sender, ssize_t size, int *do_forward) 1579 ssize_t size,
1580 int *do_forward)
1584{ 1581{
1585 struct NeighbourMapEntry *n; 1582 struct NeighbourMapEntry *n;
1586 struct GNUNET_TIME_Relative ret; 1583 struct GNUNET_TIME_Relative ret;
@@ -2824,7 +2821,6 @@ send_utilization_data (void *cls,
2824 void *value) 2821 void *value)
2825{ 2822{
2826 struct NeighbourMapEntry *n = value; 2823 struct NeighbourMapEntry *n = value;
2827 struct GNUNET_ATS_Information atsi[2];
2828 uint32_t bps_in; 2824 uint32_t bps_in;
2829 uint32_t bps_out; 2825 uint32_t bps_out;
2830 struct GNUNET_TIME_Relative delta; 2826 struct GNUNET_TIME_Relative delta;
@@ -2846,14 +2842,9 @@ send_utilization_data (void *cls,
2846 GNUNET_i2s (key), 2842 GNUNET_i2s (key),
2847 bps_in, 2843 bps_in,
2848 bps_out); 2844 bps_out);
2849 atsi[0].type = htonl (GNUNET_ATS_UTILIZATION_OUT); 2845 GST_ats_update_utilization (n->primary_address.address,
2850 atsi[0].value = htonl (bps_out); 2846 bps_in,
2851 atsi[1].type = htonl (GNUNET_ATS_UTILIZATION_IN); 2847 bps_out);
2852 atsi[1].value = htonl (bps_in);
2853 GST_ats_update_metrics (n->primary_address.address,
2854 n->primary_address.session,
2855 atsi,
2856 2);
2857 n->util_total_bytes_recv = 0; 2848 n->util_total_bytes_recv = 0;
2858 n->util_total_bytes_sent = 0; 2849 n->util_total_bytes_sent = 0;
2859 n->last_util_transmission = GNUNET_TIME_absolute_get (); 2850 n->last_util_transmission = GNUNET_TIME_absolute_get ();
@@ -3426,9 +3417,9 @@ GST_neighbours_handle_session_ack (const struct GNUNET_MessageHeader *message,
3426 return GNUNET_SYSERR; 3417 return GNUNET_SYSERR;
3427 } 3418 }
3428 GNUNET_STATISTICS_update (GST_stats, 3419 GNUNET_STATISTICS_update (GST_stats,
3429 gettext_noop 3420 gettext_noop ("# ACK messages received"),
3430 ("# ACK messages received"), 3421 1,
3431 1, GNUNET_NO); 3422 GNUNET_NO);
3432 if (NULL == (n = lookup_neighbour (&address->peer))) 3423 if (NULL == (n = lookup_neighbour (&address->peer)))
3433 { 3424 {
3434 GNUNET_break_op (0); 3425 GNUNET_break_op (0);