Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuslan Ermilov <ru@nginx.com>2013-07-25 12:46:03 +0400
committerRuslan Ermilov <ru@nginx.com>2013-07-25 12:46:03 +0400
commit02a077b827438ae17c638efed70ee1804ce7d898 (patch)
treef93428517e227cc9b9a345a490511787cb71ab11 /src/core/ngx_connection.c
parent690e2b33aa7ea56f8d7796b5412c5ef4dd89f556 (diff)
On DragonFlyBSD, TCP_KEEPIDLE and TCP_KEEPINTVL are in msecs.
Based on a patch by Sepherosa Ziehau.
Diffstat (limited to 'src/core/ngx_connection.c')
-rw-r--r--src/core/ngx_connection.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/core/ngx_connection.c b/src/core/ngx_connection.c
index 0ef145b52..e12d3efc0 100644
--- a/src/core/ngx_connection.c
+++ b/src/core/ngx_connection.c
@@ -515,24 +515,36 @@ ngx_configure_listening_sockets(ngx_cycle_t *cycle)
#if (NGX_HAVE_KEEPALIVE_TUNABLE)
if (ls[i].keepidle) {
+ value = ls[i].keepidle;
+
+#if (NGX_KEEPALIVE_FACTOR)
+ value *= NGX_KEEPALIVE_FACTOR;
+#endif
+
if (setsockopt(ls[i].fd, IPPROTO_TCP, TCP_KEEPIDLE,
- (const void *) &ls[i].keepidle, sizeof(int))
+ (const void *) &value, sizeof(int))
== -1)
{
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
"setsockopt(TCP_KEEPIDLE, %d) %V failed, ignored",
- ls[i].keepidle, &ls[i].addr_text);
+ value, &ls[i].addr_text);
}
}
if (ls[i].keepintvl) {
+ value = ls[i].keepintvl;
+
+#if (NGX_KEEPALIVE_FACTOR)
+ value *= NGX_KEEPALIVE_FACTOR;
+#endif
+
if (setsockopt(ls[i].fd, IPPROTO_TCP, TCP_KEEPINTVL,
- (const void *) &ls[i].keepintvl, sizeof(int))
+ (const void *) &value, sizeof(int))
== -1)
{
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
"setsockopt(TCP_KEEPINTVL, %d) %V failed, ignored",
- ls[i].keepintvl, &ls[i].addr_text);
+ value, &ls[i].addr_text);
}
}