提交 3ae189ca authored 作者: Travis Cross's avatar Travis Cross

Synchronize Sofia and Linux TCP keepalive timeout units

Sofia keeps the TCP keepalive timeout in milliseconds, but Linux
expects the value in seconds.  Before this change, it's unlikely the
TCP_KEEPIDLE and TCP_KEEPINTVL calls were having much effect as we
would have been passing them a huge value.

FS-6104
上级 c52ac481
......@@ -196,7 +196,11 @@ int tport_tcp_init_secondary(tport_t *self, int socket, int accepted,
#if defined(SO_KEEPALIVE)
setsockopt(socket, SOL_SOCKET, SO_KEEPALIVE, (void *)&val, sizeof val);
#endif
val = (int)(self->tp_params->tpp_keepalive);
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));
#if defined(TCP_KEEPIDLE)
if (val != 0 && val != UINT_MAX)
setsockopt(socket, SOL_TCP, TCP_KEEPIDLE, (void *)&val, sizeof val);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论