Thread (9 messages) 9 messages, 3 authors, 2010-08-30

Re: [PATCH] TCP_USER_TIMEOUT: a new socket option to specify max timeout before a TCP connection is aborted

From: David Miller <davem@davemloft.net>
Date: 2010-08-28 23:13:04

From: "H.K. Jerry Chu" <redacted>
Date: Fri, 27 Aug 2010 22:13:28 -0700
quoted hunk ↗ jump to hunk
@@ -556,7 +559,14 @@ static void tcp_keepalive_timer (unsigned long data)
 	elapsed = keepalive_time_elapsed(tp);
 
 	if (elapsed >= keepalive_time_when(tp)) {
-		if (icsk->icsk_probes_out >= keepalive_probes(tp)) {
+		/* If the TCP_USER_TIMEOUT option is enabled, use that
+		 * to determine when to timeout instead.
+		 */
+		if ((icsk->icsk_user_timeout != 0 &&
+		    elapsed >= icsk->icsk_user_timeout &&
+		    icsk->icsk_probes_out > 0) ||
+		    (icsk->icsk_user_timeout == 0 &&
+		    icsk->icsk_probes_out >= keepalive_probes(tp))) {
 			tcp_send_active_reset(sk, GFP_ATOMIC);
 			tcp_write_err(sk);
 			goto out;
I think if we want to add a socket option which overrides, it makes
more sense to provide overrides in the same units.  This
transformation here is transforming a check against apples into a
check against oranges.

But if that's how this thing is specified, so be it... I guess. :-/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help