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

@@ -969,5 +969,19 @@ int set_sock_keepalive(int fd, int keepidle, int keepinterval, int keepcnt)
setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &keepinterval, sizeof(keepinterval));
setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &keepcnt, sizeof(keepcnt));
return 0;
}
int set_sock_lingertime(int fd, int time)
{
struct linger l;
l.l_onoff = 1;
l.l_linger = 0;
if (setsockopt(fd, SOL_SOCKET, SO_LINGER, (const char *)&l, sizeof(l)) != 0) {
return -1;
}
return 0;
}