diff options
author | Masaq- <tilt@techie.com> | 2019-03-01 02:16:40 +0000 |
---|---|---|
committer | Masaq- <tilt@techie.com> | 2019-03-01 02:16:40 +0000 |
commit | 47627aca9b4b59c11eedc319f00000c3c4452515 (patch) | |
tree | 967fc19a365b148017cb2b9eca420a03d8bcf188 /src/ptunnel.c | |
parent | ca931dfbce1f53aa510e4974fbcc584ee4d8744e (diff) |
empty pings not to be sent when idle
Diffstat (limited to 'src/ptunnel.c')
-rw-r--r-- | src/ptunnel.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/ptunnel.c b/src/ptunnel.c index ff92937..1c4d8fd 100644 --- a/src/ptunnel.c +++ b/src/ptunnel.c @@ -662,13 +662,15 @@ void* pt_proxy(void *args) { cur->remote_ack_val+1 != cur->next_remote_seq) { idx = cur->send_idx; - cur->last_ack = now; queue_packet(fwd_sock, cur->pkt_type, 0, 0, cur->id_no, cur->icmp_id, &cur->my_seq, cur->send_ring, &cur->send_idx, &cur->send_wait_ack, cur->dst_ip, cur->dst_port, kProto_ack | cur->type_flag, &cur->dest_addr, cur->next_remote_seq, &cur->send_first_ack, &cur->ping_seq, cur->window_size); cur->xfer.icmp_ack_out++; - if (cur->send_ring[idx].pkt_len > sizeof(icmp_echo_packet_t) && cur->send_ring[idx].pkt->type == kICMP_echo_request) { + if (opts.empty_pings && + cur->last_data_activity > cur->last_ack && + cur->send_ring[idx].pkt_len > sizeof(icmp_echo_packet_t) && + cur->send_ring[idx].pkt->type == kICMP_echo_request) { for (uint16_t e = 0; e < opts.empty_pings; e++) { cur->send_ring[idx].pkt->seq = htons(cur->ping_seq); cur->ping_seq++; @@ -678,6 +680,7 @@ void* pt_proxy(void *args) { 0, (struct sockaddr*)&cur->dest_addr, sizeof(struct sockaddr)); } } + cur->last_ack = now; } } pthread_mutex_unlock(&chain_lock); |