This separates out the Linux socket TCP keepalive timeout interval
from Sofia's internal mechanisms. Earlier we tied these together. In
retrospect this seems improper.
These two values can now be set separately.
You might, for example, want to keep the Sofia internal mechanism
disabled completely while enabling the platform-based mechanism if
your platform supports it.
We also here reform the default value of the socket TCP keepalive
parameter to 30 seconds.
This is what commit
1bf17857c9a322df50305606ca41203053001818 should
have been.
FS-6104
TPORT_DLL extern tag_typedef_t tptag_timeout_ref;
#define TPTAG_TIMEOUT_REF(x) tptag_timeout_ref, tag_uint_vr(&(x))
+TPORT_DLL extern tag_typedef_t tptag_socket_keepalive;
+#define TPTAG_SOCKET_KEEPALIVE(x) tptag_socket_keepalive, tag_uint_v((x))
+
+TPORT_DLL extern tag_typedef_t tptag_socket_keepalive_ref;
+#define TPTAG_SOCKET_KEEPALIVE_REF(x) tptag_socket_keepalive_ref, tag_uint_vr(&(x))
+
TPORT_DLL extern tag_typedef_t tptag_keepalive;
#define TPTAG_KEEPALIVE(x) tptag_keepalive, tag_uint_v((x))
tpp->tpp_idle = UINT_MAX;
tpp->tpp_timeout = UINT_MAX;
tpp->tpp_sigcomp_lifetime = UINT_MAX;
+ tpp->tpp_socket_keepalive = 30;
tpp->tpp_keepalive = 0;
tpp->tpp_pingpong = 0;
tpp->tpp_pong2ping = 0;
TPTAG_QUEUESIZE(tpp->tpp_qsize),
TPTAG_IDLE(tpp->tpp_idle),
TPTAG_TIMEOUT(tpp->tpp_timeout),
+ TPTAG_SOCKET_KEEPALIVE(tpp->tpp_socket_keepalive),
TPTAG_KEEPALIVE(tpp->tpp_keepalive),
TPTAG_PINGPONG(tpp->tpp_pingpong),
TPTAG_PONG2PING(tpp->tpp_pong2ping),
TAG_IF(!self->tp_queue, TPTAG_QUEUESIZE_REF(tpp->tpp_qsize)),
TPTAG_IDLE_REF(tpp->tpp_idle),
TPTAG_TIMEOUT_REF(tpp->tpp_timeout),
+ TPTAG_SOCKET_KEEPALIVE_REF(tpp->tpp_socket_keepalive),
TPTAG_KEEPALIVE_REF(tpp->tpp_keepalive),
TPTAG_PINGPONG_REF(tpp->tpp_pingpong),
TPTAG_PONG2PING_REF(pong2ping),
unsigned tpp_mtu; /**< Maximum packet size */
unsigned tpp_idle; /**< Allowed connection idle time. */
unsigned tpp_timeout; /**< Allowed idle time for message. */
+ unsigned tpp_socket_keepalive;/**< Socket keepalive interval */
unsigned tpp_keepalive; /**< Keepalive PING interval */
unsigned tpp_pingpong; /**< PONG-to-PING interval */
*/
tag_typedef_t tptag_timeout = UINTTAG_TYPEDEF(timeout);
+/**@def TPTAG_SOCKET_KEEPALIVE(x)
+ *
+ * Keepalive interval set on socket (where supported) in seconds.
+ *
+ * If 0 or UINT_MAX, do not use keepalives. Default value is 30.
+ */
+tag_typedef_t tptag_socket_keepalive = UINTTAG_TYPEDEF(socket_keepalive);
+
/**@def TPTAG_KEEPALIVE(x)
*
* Keepalive interval in milliseconds.
#if defined(SO_KEEPALIVE)
setsockopt(socket, SOL_SOCKET, SO_KEEPALIVE, (void *)&val, sizeof val);
#endif
- val = (int)(self->tp_params->tpp_keepalive / 1000);
- if (!val && (self->tp_params->tpp_keepalive > 0))
- SU_DEBUG_1(("%s(%p): Ignoring TCP keepalive value %u (<1000)\n",
- __func__, (void *)self,
- self->tp_params->tpp_keepalive));
+ val = (int)(self->tp_params->tpp_socket_keepalive);
#if defined(TCP_KEEPIDLE)
if (val != 0 && val != UINT_MAX) {
SU_DEBUG_3(("%s(%p): Setting TCP_KEEPIDLE to %d\n",