Revert "Enable keep alive later and enable on remote close"

This reverts commit fd614bcbd7.
This commit is contained in:
M66B 2016-03-01 11:12:21 +01:00
parent 54cb29cd15
commit 5402eeed2a
2 changed files with 4 additions and 17 deletions

View File

@ -48,8 +48,7 @@
#define TCP_RECV_WINDOW 16384 // bytes (maximum) #define TCP_RECV_WINDOW 16384 // bytes (maximum)
#define TCP_SEND_WINDOW 16384 // bytes (maximum) #define TCP_SEND_WINDOW 16384 // bytes (maximum)
#define TCP_INIT_TIMEOUT 30 // seconds ~net.inet.tcp.keepinit #define TCP_INIT_TIMEOUT 30 // seconds ~net.inet.tcp.keepinit
#define TCP_KEEPALIVE_AFTER 1800 // seconds #define TCP_IDLE_TIMEOUT 300 // seconds ~net.inet.tcp.keepidle
#define TCP_IDLE_TIMEOUT 3600 // seconds ~net.inet.tcp.keepidle
#define TCP_CLOSE_TIMEOUT 30 // seconds #define TCP_CLOSE_TIMEOUT 30 // seconds
#define TCP_KEEP_TIMEOUT 300 // seconds #define TCP_KEEP_TIMEOUT 300 // seconds
// https://en.wikipedia.org/wiki/Maximum_segment_lifetime // https://en.wikipedia.org/wiki/Maximum_segment_lifetime

View File

@ -69,13 +69,9 @@ int get_tcp_timeout(const struct tcp_session *t, int sessions, int maxsessions)
if (t->keep_alive) if (t->keep_alive)
timeout = TCP_IDLE_TIMEOUT; timeout = TCP_IDLE_TIMEOUT;
else else
timeout = TCP_KEEPALIVE_AFTER; timeout = TCP_IDLE_TIMEOUT / 2;
} else { } else
if (t->state == TCP_CLOSE_WAIT)
timeout = TCP_IDLE_TIMEOUT;
else
timeout = TCP_CLOSE_TIMEOUT; timeout = TCP_CLOSE_TIMEOUT;
}
int scale = 100 - sessions * 100 / maxsessions; int scale = 100 - sessions * 100 / maxsessions;
timeout = timeout * scale / 100; timeout = timeout * scale / 100;
@ -630,14 +626,6 @@ jboolean handle_tcp(const struct arguments *args,
} }
else else
cur->state = TCP_CLOSE_WAIT; cur->state = TCP_CLOSE_WAIT;
int on = 1;
if (setsockopt(cur->socket, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof(on)))
log_android(ANDROID_LOG_ERROR,
"%s setsockopt SO_KEEPALIVE error %d: %s",
session, errno, strerror(errno));
else
log_android(ANDROID_LOG_WARN, "%s enabled keep alive", session);
} }
else if (cur->state == TCP_CLOSE_WAIT) { else if (cur->state == TCP_CLOSE_WAIT) {