[sr-dev] git:pd/websocket: core: make it possible to retrieve TCP connection without updating connection liifetime
Peter Dunkley
peter.dunkley at crocodile-rcs.com
Sun Jun 17 00:00:17 CEST 2012
Module: sip-router
Branch: pd/websocket
Commit: 74a32e90a9c86c40d9497a9543eedba63556e865
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=74a32e90a9c86c40d9497a9543eedba63556e865
Author: Peter Dunkley <peter.dunkley at crocodile-rcs.com>
Committer: Peter Dunkley <peter.dunkley at crocodile-rcs.com>
Date: Sat Jun 16 22:58:00 2012 +0100
core: make it possible to retrieve TCP connection without updating connection liifetime
---
tcp_main.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/tcp_main.c b/tcp_main.c
index d629647..c5a2547 100644
--- a/tcp_main.c
+++ b/tcp_main.c
@@ -1540,10 +1540,11 @@ struct tcp_connection* tcpconn_get(int id, struct ip_addr* ip, int port,
if (likely(c)){
atomic_inc(&c->refcnt);
/* update the timeout only if the connection is not handled
- * by a tcp reader (the tcp reader process uses c->timeout for
- * its own internal timeout and c->timeout will be overwritten
- * anyway on return to tcp_main) */
- if (likely(c->reader_pid==0))
+ * by a tcp reader _and_the timeout is non-zero (the tcp
+ * reader process uses c->timeout for its own internal
+ * timeout and c->timeout will be overwritten * anyway on
+ * return to tcp_main) */
+ if (likely(c->reader_pid==0 && timeout != 0))
c->timeout=get_ticks_raw()+timeout;
}
TCPCONN_UNLOCK;
More information about the sr-dev
mailing list