Welcome! Log In Create A New Profile

Advanced

[nginx] On DragonFlyBSD, TCP_KEEPIDLE and TCP_KEEPINTVL are in m...

Ruslan Ermilov
July 25, 2013 04:48AM
details: http://hg.nginx.org/nginx/rev/6d73e0dc4f64
branches:
changeset: 5283:6d73e0dc4f64
user: Ruslan Ermilov <ru@nginx.com>
date: Thu Jul 25 12:46:03 2013 +0400
description:
On DragonFlyBSD, TCP_KEEPIDLE and TCP_KEEPINTVL are in msecs.

Based on a patch by Sepherosa Ziehau.

diffstat:

src/core/ngx_connection.c | 20 ++++++++++++++++----
src/os/unix/ngx_freebsd_config.h | 5 +++++
2 files changed, 21 insertions(+), 4 deletions(-)

diffs (59 lines):

diff -r 31690d934175 -r 6d73e0dc4f64 src/core/ngx_connection.c
--- a/src/core/ngx_connection.c Thu Jul 25 12:46:02 2013 +0400
+++ b/src/core/ngx_connection.c Thu Jul 25 12:46:03 2013 +0400
@@ -515,24 +515,36 @@ ngx_configure_listening_sockets(ngx_cycl
#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);
}
}

diff -r 31690d934175 -r 6d73e0dc4f64 src/os/unix/ngx_freebsd_config.h
--- a/src/os/unix/ngx_freebsd_config.h Thu Jul 25 12:46:02 2013 +0400
+++ b/src/os/unix/ngx_freebsd_config.h Thu Jul 25 12:46:03 2013 +0400
@@ -94,6 +94,11 @@ typedef struct aiocb ngx_aiocb_t;
#define NGX_LISTEN_BACKLOG -1


+#ifdef __DragonFly__
+#define NGX_KEEPALIVE_FACTOR 1000
+#endif
+
+
#if (__FreeBSD_version < 430000 || __FreeBSD_version < 500012)

pid_t rfork_thread(int flags, void *stack, int (*func)(void *arg), void *arg);

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] On DragonFlyBSD, TCP_KEEPIDLE and TCP_KEEPINTVL are in m...

Ruslan Ermilov 1500 July 25, 2013 04:48AM

Re: [nginx] On DragonFlyBSD, TCP_KEEPIDLE and TCP_KEEPINTVL are in m...

Sepherosa Ziehau 463 July 25, 2013 04:52AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 187
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready