Update "now" after connect() when making outgoing connections.
authorGuus Sliepen <guus@tinc-vpn.org>
Sun, 1 Nov 2015 20:07:56 +0000 (21:07 +0100)
committerGuus Sliepen <guus@tinc-vpn.org>
Sun, 1 Nov 2015 20:11:00 +0000 (21:11 +0100)
It could be that address resolution takes a long time, don't let that
count against a connection. This is especially important when using a
nameserver from the VPN.

src/net_socket.c

index cb27106..c167c2f 100644 (file)
@@ -457,8 +457,11 @@ begin:
                freeaddrinfo(proxyai);
        }
 
                freeaddrinfo(proxyai);
        }
 
+       now = time(NULL);
+
        if(result == -1) {
                if(sockinprogress(sockerrno)) {
        if(result == -1) {
                if(sockinprogress(sockerrno)) {
+                       c->last_ping_time = now;
                        c->status.connecting = true;
                        return;
                }
                        c->status.connecting = true;
                        return;
                }