… | |
… | |
62 | |
62 | |
63 | if (!getsockopt (fd, IPPROTO_TCP, TCP_INFO, &tcpi, &len) && len == sizeof (tcpi)) |
63 | if (!getsockopt (fd, IPPROTO_TCP, TCP_INFO, &tcpi, &len) && len == sizeof (tcpi)) |
64 | { |
64 | { |
65 | unsigned int diff = tcpi.tcpi_last_ack_recv - tcpi.tcpi_last_data_sent; |
65 | unsigned int diff = tcpi.tcpi_last_ack_recv - tcpi.tcpi_last_data_sent; |
66 | |
66 | |
|
|
67 | rtt = tcpi.tcpi_rtt; |
|
|
68 | rttvar = tcpi.tcpi_rttvar; |
|
|
69 | |
67 | if (tcpi.tcpi_unacked && SOCKET_TIMEOUT1 * TCP_HZ < diff && diff < 0x80000000UL // ack delayed for 20s |
70 | if (tcpi.tcpi_unacked && SOCKET_TIMEOUT1 * TCP_HZ < diff && diff < 0x80000000UL // ack delayed for 20s |
68 | && SOCKET_TIMEOUT2 * TCP_HZ < tcpi.tcpi_last_data_sent) // no data sent for 10s |
71 | && SOCKET_TIMEOUT2 * TCP_HZ < tcpi.tcpi_last_data_sent) // no data sent for 10s |
69 | { |
72 | { |
70 | LOG (llevDebug, "Connection on fd %d closed due to ack timeout (%u/%u/%u)\n", fd, |
73 | LOG (llevDebug, "Connection on fd %d closed due to ack timeout (%u/%u/%u)\n", fd, |
71 | (unsigned) tcpi.tcpi_last_ack_recv, (unsigned) tcpi.tcpi_last_data_sent, (unsigned) tcpi.tcpi_unacked); |
74 | (unsigned) tcpi.tcpi_last_ack_recv, (unsigned) tcpi.tcpi_last_data_sent, (unsigned) tcpi.tcpi_unacked); |