fast-ping: force send RST after ping finish.

This commit is contained in:
Nick Peng
2020-04-19 09:43:47 +08:00
parent 3985ea8269
commit 304e94bc6f
3 changed files with 21 additions and 0 deletions

View File

@@ -573,6 +573,11 @@ static int _fast_ping_sendping_tcp(struct ping_host_struct *ping_host)
setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &yes, sizeof(yes));
setsockopt(fd, SOL_SOCKET, SO_PRIORITY, &priority, sizeof(priority));
setsockopt(fd, IPPROTO_IP, IP_TOS, &ip_tos, sizeof(ip_tos));
set_sock_keepalive(fd, 0, 0, 0);
/* Set the socket lingering so we will RST connections instead of wasting
* bandwidth with the four-step close
*/
set_sock_lingertime(fd, 0);
ping_host->seq++;
if (connect(fd, (struct sockaddr *)&ping_host->addr, ping_host->addr_len) != 0) {