Remove bandwidth estimation code.
authorEtienne Dechamps <etienne@edechamps.fr>
Tue, 30 Dec 2014 10:47:56 +0000 (10:47 +0000)
committerEtienne Dechamps <etienne@edechamps.fr>
Fri, 2 Jan 2015 09:55:09 +0000 (09:55 +0000)
tinc bandwidth estimation has always been quite unreliable (at least in
my experience), but there's no chance of it working anymore since the
last changes to MTU discovery code, because packets are not sent in
batches of three anymore.

This commit removes the dead code - fortunately, nothing depends on this
estimation (it's not even shown in node info). We probably need be
smarter about this if we do want this estimation back.

src/net_packet.c
src/node.h

index 9bebca4..828e193 100644 (file)
@@ -157,10 +157,9 @@ static void udp_probe_h(node_t *n, vpn_packet_t *packet, length_t len) {
                        try_fix_mtu(n);
                }
 
-               /* Calculate RTT and bandwidth.
+               /* Calculate RTT.
                   The RTT is the time between the MTU probe burst was sent and the first
-                  reply is received. The bandwidth is measured using the time between the
-                  arrival of the first and third probe reply (or type 2 probe requests).
+                  reply is received.
                 */
 
                struct timeval now, diff;
@@ -180,12 +179,7 @@ static void udp_probe_h(node_t *n, vpn_packet_t *packet, length_t len) {
                if(n->probe_counter == 1) {
                        n->rtt = diff.tv_sec + diff.tv_usec * 1e-6;
                        n->probe_time = probe_timestamp;
-               } else if(n->probe_counter == 3) {
-                       /* TODO: this will never fire - we're not sending batches of three anymore. */
-                       struct timeval probe_timestamp_diff;
-                       timersub(&probe_timestamp, &n->probe_time, &probe_timestamp_diff);
-                       n->bandwidth = 2.0 * probelen / (probe_timestamp_diff.tv_sec + probe_timestamp_diff.tv_usec * 1e-6);
-                       logger(DEBUG_TRAFFIC, LOG_DEBUG, "%s (%s) RTT %.2f ms, burst bandwidth %.3f Mbit/s, rx packet loss %.2f %%", n->name, n->hostname, n->rtt * 1e3, n->bandwidth * 8e-6, n->packetloss * 1e2);
+                       logger(DEBUG_TRAFFIC, LOG_DEBUG, "%s (%s) RTT %.2f ms, rx packet loss %.2f %%", n->name, n->hostname, n->rtt * 1e3, n->packetloss * 1e2);
                }
        }
 }
index 08e6017..4f6232b 100644 (file)
@@ -98,7 +98,6 @@ typedef struct node_t {
        struct timeval probe_time;              /* Time the last probe was sent or received */
        int probe_counter;                      /* Number of probes received since last burst was sent */
        float rtt;                              /* Last measured round trip time */
-       float bandwidth;                        /* Last measured bandwidth */
        float packetloss;                       /* Last measured packet loss rate */
 
        uint64_t in_packets;