mirror of
https://github.com/M66B/NetGuard.git
synced 2025-01-04 06:23:04 +00:00
parent
935df7491c
commit
9f6bf62f62
2 changed files with 2 additions and 19 deletions
|
@ -50,11 +50,10 @@
|
||||||
#define UDP_KEEP_TIMEOUT 60 // seconds
|
#define UDP_KEEP_TIMEOUT 60 // seconds
|
||||||
|
|
||||||
#define TCP_INIT_TIMEOUT 30 // seconds ~net.inet.tcp.keepinit
|
#define TCP_INIT_TIMEOUT 30 // seconds ~net.inet.tcp.keepinit
|
||||||
#define TCP_IDLE_TIMEOUT 29 // 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
|
||||||
#define TCP_KEEP_ALIVE 30 // seconds
|
|
||||||
|
|
||||||
#define UID_DELAY 1 // milliseconds
|
#define UID_DELAY 1 // milliseconds
|
||||||
#define UID_DELAYTRY 10 // milliseconds
|
#define UID_DELAYTRY 10 // milliseconds
|
||||||
|
|
|
@ -128,11 +128,8 @@ int monitor_tcp_session(const struct arguments *args, struct ng_session *s, int
|
||||||
}
|
}
|
||||||
else if (s->tcp.state == TCP_ESTABLISHED || s->tcp.state == TCP_CLOSE_WAIT) {
|
else if (s->tcp.state == TCP_ESTABLISHED || s->tcp.state == TCP_CLOSE_WAIT) {
|
||||||
|
|
||||||
uint32_t rwindow = get_receive_window(s);
|
|
||||||
uint32_t swindow = get_send_window(&s->tcp);
|
|
||||||
|
|
||||||
// Check for incoming data
|
// Check for incoming data
|
||||||
if (swindow > 0)
|
if (get_send_window(&s->tcp) > 0)
|
||||||
events = events | EPOLLIN;
|
events = events | EPOLLIN;
|
||||||
else {
|
else {
|
||||||
recheck = 1;
|
recheck = 1;
|
||||||
|
@ -156,19 +153,6 @@ int monitor_tcp_session(const struct arguments *args, struct ng_session *s, int
|
||||||
else
|
else
|
||||||
recheck = 1;
|
recheck = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Keep alive
|
|
||||||
if (rwindow > 0 && swindow > 0) {
|
|
||||||
long long ms = get_ms();
|
|
||||||
if (s->tcp.time + TCP_KEEP_ALIVE < time(NULL) &&
|
|
||||||
ms - s->tcp.last_keep_alive > TCP_KEEP_ALIVE * 1000) {
|
|
||||||
s->tcp.last_keep_alive = ms;
|
|
||||||
log_android(ANDROID_LOG_WARN, "Sending keep alive");
|
|
||||||
s->tcp.remote_seq--;
|
|
||||||
write_ack(args, &s->tcp);
|
|
||||||
s->tcp.remote_seq++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (events != s->ev.events) {
|
if (events != s->ev.events) {
|
||||||
|
|
Loading…
Reference in a new issue