X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fnet_socket.c;h=c167c2f3a5e00eb21f74b99897ac851b73b9404a;hp=9a67bb3cebb63e1c0529c09fc50f21c6f83e5094;hb=afd342ec0c2db5f4f60d29dfec87249c7503a1f5;hpb=d7be59a9dc6540f7ae6b7d5d6e595265f5f8b3cc diff --git a/src/net_socket.c b/src/net_socket.c index 9a67bb3c..c167c2f3 100644 --- a/src/net_socket.c +++ b/src/net_socket.c @@ -40,6 +40,7 @@ #endif int addressfamily = AF_UNSPEC; +int mintimeout = 0; int maxtimeout = 900; int seconds_till_retry = 5; int udp_rcvbuf = 0; @@ -77,6 +78,11 @@ static void configure_tcp(connection_t *c) { option = IPTOS_LOWDELAY; setsockopt(c->socket, SOL_IP, IP_TOS, (void *)&option, sizeof(option)); #endif + +#if defined(IPPROTO_IPV6) && defined(IPV6_TCLASS) && defined(IPTOS_LOWDELAY) + option = IPTOS_LOWDELAY; + setsockopt(c->socket, IPPROTO_IPV6, IPV6_TCLASS, (void *)&option, sizeof(option)); +#endif } static bool bind_to_interface(int sd) { @@ -273,6 +279,9 @@ int setup_vpn_in_socket(const sockaddr_t *sa) { void retry_outgoing(outgoing_t *outgoing) { outgoing->timeout += 5; + if(outgoing->timeout < mintimeout) + outgoing->timeout = mintimeout; + if(outgoing->timeout > maxtimeout) outgoing->timeout = maxtimeout; @@ -448,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; }