aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-transport_neighbours.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-02-03 15:31:02 +0000
committerChristian Grothoff <christian@grothoff.org>2015-02-03 15:31:02 +0000
commit7398fe2d019c3a456bc0c565926d8c25d41d9c53 (patch)
tree8133e201f0c8929e0e47d21676f5c5f2eb2c92e7 /src/transport/gnunet-service-transport_neighbours.c
parentb4e898498bebd50dfceaaa939d28eb5150aa9984 (diff)
downloadgnunet-7398fe2d019c3a456bc0c565926d8c25d41d9c53.tar.gz
gnunet-7398fe2d019c3a456bc0c565926d8c25d41d9c53.zip
get rid of unused state and dead code: GST_neighbour_get_latency is never used
Diffstat (limited to 'src/transport/gnunet-service-transport_neighbours.c')
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c61
1 files changed, 6 insertions, 55 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index 2ec446b82..55bcbacef 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -377,11 +377,6 @@ struct NeighbourMapEntry
377 struct GNUNET_TIME_Absolute timeout; 377 struct GNUNET_TIME_Absolute timeout;
378 378
379 /** 379 /**
380 * Latest calculated latency value
381 */
382 struct GNUNET_TIME_Relative latency;
383
384 /**
385 * Tracker for inbound bandwidth. 380 * Tracker for inbound bandwidth.
386 */ 381 */
387 struct GNUNET_BANDWIDTH_Tracker in_tracker; 382 struct GNUNET_BANDWIDTH_Tracker in_tracker;
@@ -1501,8 +1496,8 @@ GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour,
1501 struct NeighbourMapEntry *n; 1496 struct NeighbourMapEntry *n;
1502 const struct SessionKeepAliveMessage *msg; 1497 const struct SessionKeepAliveMessage *msg;
1503 struct GNUNET_TRANSPORT_PluginFunctions *papi; 1498 struct GNUNET_TRANSPORT_PluginFunctions *papi;
1504 uint32_t latency;
1505 struct GNUNET_ATS_Information ats; 1499 struct GNUNET_ATS_Information ats;
1500 struct GNUNET_TIME_Relative latency;
1506 1501
1507 if (sizeof (struct SessionKeepAliveMessage) != ntohs (m->size)) 1502 if (sizeof (struct SessionKeepAliveMessage) != ntohs (m->size))
1508 return; 1503 return;
@@ -1564,21 +1559,19 @@ GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour,
1564 1559
1565 n->primary_address.keep_alive_nonce = 0; 1560 n->primary_address.keep_alive_nonce = 0;
1566 n->expect_latency_response = GNUNET_NO; 1561 n->expect_latency_response = GNUNET_NO;
1567 n->latency = GNUNET_TIME_absolute_get_duration (n->last_keep_alive_time);
1568 set_timeout (n, GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT)); 1562 set_timeout (n, GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT));
1569 1563
1564 latency = GNUNET_TIME_absolute_get_duration (n->last_keep_alive_time);
1570 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1565 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1571 "Latency for peer `%s' is %s\n", 1566 "Latency for peer `%s' is %s\n",
1572 GNUNET_i2s (&n->id), 1567 GNUNET_i2s (&n->id),
1573 GNUNET_STRINGS_relative_time_to_string (n->latency, 1568 GNUNET_STRINGS_relative_time_to_string (latency,
1574 GNUNET_YES)); 1569 GNUNET_YES));
1575 /* append latency */ 1570 /* append latency */
1576 ats.type = htonl (GNUNET_ATS_QUALITY_NET_DELAY); 1571 ats.type = htonl (GNUNET_ATS_QUALITY_NET_DELAY);
1577 if (n->latency.rel_value_us > UINT32_MAX) 1572 ats.value = htonl ( (latency.rel_value_us > UINT32_MAX)
1578 latency = UINT32_MAX; 1573 ? UINT32_MAX
1579 else 1574 : (uint32_t) latency.rel_value_us );
1580 latency = n->latency.rel_value_us;
1581 ats.value = htonl (latency);
1582 GST_ats_update_metrics (n->primary_address.address, 1575 GST_ats_update_metrics (n->primary_address.address,
1583 n->primary_address.session, 1576 n->primary_address.session,
1584 &ats, 1); 1577 &ats, 1);
@@ -2057,7 +2050,6 @@ setup_neighbour (const struct GNUNET_PeerIdentity *peer)
2057 n = GNUNET_new (struct NeighbourMapEntry); 2050 n = GNUNET_new (struct NeighbourMapEntry);
2058 n->id = *peer; 2051 n->id = *peer;
2059 n->ack_state = ACK_UNDEFINED; 2052 n->ack_state = ACK_UNDEFINED;
2060 n->latency = GNUNET_TIME_UNIT_FOREVER_REL;
2061 n->last_util_transmission = GNUNET_TIME_absolute_get(); 2053 n->last_util_transmission = GNUNET_TIME_absolute_get();
2062 n->util_payload_bytes_recv = 0; 2054 n->util_payload_bytes_recv = 0;
2063 n->util_payload_bytes_sent = 0; 2055 n->util_payload_bytes_sent = 0;
@@ -3807,47 +3799,6 @@ GST_neighbours_force_disconnect (const struct GNUNET_PeerIdentity *target)
3807 3799
3808 3800
3809/** 3801/**
3810 * Obtain current latency information for the given neighbour.
3811 *
3812 * @param peer to get the latency for
3813 * @return observed latency of the address, FOREVER if the
3814 * the connection is not up
3815 */
3816struct GNUNET_TIME_Relative
3817GST_neighbour_get_latency (const struct GNUNET_PeerIdentity *peer)
3818{
3819 struct NeighbourMapEntry *n;
3820
3821 n = lookup_neighbour (peer);
3822 if (NULL == n)
3823 return GNUNET_TIME_UNIT_FOREVER_REL;
3824 switch (n->state)
3825 {
3826 case GNUNET_TRANSPORT_PS_CONNECTED:
3827 case GNUNET_TRANSPORT_PS_SWITCH_SYN_SENT:
3828 case GNUNET_TRANSPORT_PS_RECONNECT_SENT:
3829 case GNUNET_TRANSPORT_PS_RECONNECT_ATS:
3830 return n->latency;
3831 case GNUNET_TRANSPORT_PS_NOT_CONNECTED:
3832 case GNUNET_TRANSPORT_PS_INIT_ATS:
3833 case GNUNET_TRANSPORT_PS_SYN_RECV_ATS:
3834 case GNUNET_TRANSPORT_PS_SYN_RECV_ACK:
3835 case GNUNET_TRANSPORT_PS_SYN_SENT:
3836 case GNUNET_TRANSPORT_PS_DISCONNECT:
3837 case GNUNET_TRANSPORT_PS_DISCONNECT_FINISHED:
3838 return GNUNET_TIME_UNIT_FOREVER_REL;
3839 default:
3840 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
3841 "Unhandled state `%s'\n",
3842 GNUNET_TRANSPORT_ps2s (n->state));
3843 GNUNET_break (0);
3844 break;
3845 }
3846 return GNUNET_TIME_UNIT_FOREVER_REL;
3847}
3848
3849
3850/**
3851 * Obtain current address information for the given neighbour. 3802 * Obtain current address information for the given neighbour.
3852 * 3803 *
3853 * @param peer 3804 * @param peer