Timed keep alive to update send window

This commit is contained in:
M66B 2016-06-27 08:38:43 +02:00
parent ce51eecc52
commit fb1b5d7aa8
2 changed files with 5 additions and 4 deletions

View File

@ -145,7 +145,7 @@ struct tcp_session {
uint32_t local_start;
uint32_t acked; // host notation
uint32_t keep_alive; // host notation
long long last_keep_alive;
uint64_t sent;
uint64_t received;

View File

@ -126,8 +126,9 @@ int monitor_tcp_session(const struct arguments *args, struct ng_session *s, int
else {
recheck = 1;
if (s->tcp.keep_alive != s->tcp.remote_seq) {
s->tcp.keep_alive = s->tcp.remote_seq;
long long ms = get_ms();
if (ms - s->tcp.last_keep_alive > EPOLL_MIN_CHECK) {
s->tcp.last_keep_alive = ms;
log_android(ANDROID_LOG_WARN, "Sending keep alive to update send window");
s->tcp.remote_seq--;
write_ack(args, &s->tcp);
@ -533,7 +534,7 @@ jboolean handle_tcp(const struct arguments *args,
s->tcp.remote_start = s->tcp.remote_seq;
s->tcp.local_start = s->tcp.local_seq;
s->tcp.acked = 0;
s->tcp.keep_alive = 0;
s->tcp.last_keep_alive = 0;
s->tcp.sent = 0;
s->tcp.received = 0;