From: Guus Sliepen <guus@tinc-vpn.org>
Date: Sun, 1 Nov 2015 20:07:56 +0000 (+0100)
Subject: Update "now" after connect() when making outgoing connections.
X-Git-Tag: release-1.0.27~26
X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=afd342ec0c2db5f4f60d29dfec87249c7503a1f5;p=oweals%2Ftinc.git

Update "now" after connect() when making outgoing connections.

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.
---

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