Browse code

core: make it possible to retrieve TCP connection without updating connection liifetime

Peter Dunkley authored on 16/06/2012 21:58:00
Showing 1 changed files
... ...
@@ -1540,10 +1540,11 @@ struct tcp_connection* tcpconn_get(int id, struct ip_addr* ip, int port,
1540 1540
 	if (likely(c)){ 
1541 1541
 			atomic_inc(&c->refcnt);
1542 1542
 			/* update the timeout only if the connection is not handled
1543
-			 * by a tcp reader (the tcp reader process uses c->timeout for 
1544
-			 * its own internal timeout and c->timeout will be overwritten
1545
-			 * anyway on return to tcp_main) */
1546
-			if (likely(c->reader_pid==0))
1543
+			 * by a tcp reader _and_the timeout is non-zero  (the tcp
1544
+			 * reader process uses c->timeout for its own internal
1545
+			 * timeout and c->timeout will be overwritten * anyway on
1546
+			 * return to tcp_main) */
1547
+			if (likely(c->reader_pid==0 && timeout != 0))
1547 1548
 				c->timeout=get_ticks_raw()+timeout;
1548 1549
 	}
1549 1550
 	TCPCONN_UNLOCK;