projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update "now" after connect() when making outgoing connections.
[tinc]
/
src
/
net_socket.c
diff --git
a/src/net_socket.c
b/src/net_socket.c
index
9a67bb3
..
c167c2f
100644
(file)
--- a/
src/net_socket.c
+++ b/
src/net_socket.c
@@
-40,6
+40,7
@@
#endif
int addressfamily = AF_UNSPEC;
#endif
int addressfamily = AF_UNSPEC;
+int mintimeout = 0;
int maxtimeout = 900;
int seconds_till_retry = 5;
int udp_rcvbuf = 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
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) {
}
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;
void retry_outgoing(outgoing_t *outgoing) {
outgoing->timeout += 5;
+ if(outgoing->timeout < mintimeout)
+ outgoing->timeout = mintimeout;
+
if(outgoing->timeout > maxtimeout)
outgoing->timeout = maxtimeout;
if(outgoing->timeout > maxtimeout)
outgoing->timeout = maxtimeout;
@@
-448,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;
}