summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2012-04-10 03:48:22 +0000
committerBenny Prijono <bennylp@teluu.com>2012-04-10 03:48:22 +0000
commit631167962702f99445f26aae08e9068b863283e8 (patch)
tree73ec5ac9162552c0e7b4e4b16a48d71c723aabc8
parent80b76e6f36410805b434a72b452db8f505b8a5d0 (diff)
More re #1465: introduce separate idle timeout setting for server side TCP/TLS connection and set the default to 600 seconds
git-svn-id: http://svn.pjsip.org/repos/pjproject/branches/1.x@4032 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjsip/include/pjsip/sip_config.h18
-rw-r--r--pjsip/src/pjsip/sip_transport.c4
2 files changed, 19 insertions, 3 deletions
diff --git a/pjsip/include/pjsip/sip_config.h b/pjsip/include/pjsip/sip_config.h
index 3d0c0946..8efc8814 100644
--- a/pjsip/include/pjsip/sip_config.h
+++ b/pjsip/include/pjsip/sip_config.h
@@ -427,8 +427,9 @@ PJ_INLINE(pjsip_cfg_t*) pjsip_cfg(void)
/**
- * Idle timeout interval to be applied to transports with no usage
- * before the transport is destroyed. Value is in seconds.
+ * Idle timeout interval to be applied to outgoing transports (i.e. client
+ * side) with no usage before the transport is destroyed. Value is in
+ * seconds.
*
* Default: 30
*/
@@ -438,6 +439,19 @@ PJ_INLINE(pjsip_cfg_t*) pjsip_cfg(void)
/**
+ * Idle timeout interval to be applied to incoming transports (i.e. server
+ * side) with no usage before the transport is destroyed. Server typically
+ * should let client close the connection, hence set this interval to a large
+ * value. Value is in seconds.
+ *
+ * Default: 600
+ */
+#ifndef PJSIP_TRANSPORT_SERVER_IDLE_TIME
+# define PJSIP_TRANSPORT_SERVER_IDLE_TIME 600
+#endif
+
+
+/**
* Maximum number of usages for a transport before a new transport is
* created. This only applies for ephemeral transports such as TCP.
*
diff --git a/pjsip/src/pjsip/sip_transport.c b/pjsip/src/pjsip/sip_transport.c
index 13b33e09..556868cf 100644
--- a/pjsip/src/pjsip/sip_transport.c
+++ b/pjsip/src/pjsip/sip_transport.c
@@ -857,7 +857,9 @@ PJ_DEF(pj_status_t) pjsip_transport_dec_ref( pjsip_transport *tp )
if (tp->is_shutdown) {
delay.sec = delay.msec = 0;
} else {
- delay.sec = PJSIP_TRANSPORT_IDLE_TIME;
+ delay.sec = (tp->dir==PJSIP_TP_DIR_OUTGOING) ?
+ PJSIP_TRANSPORT_IDLE_TIME :
+ PJSIP_TRANSPORT_SERVER_IDLE_TIME;
delay.msec = 0;
}