diff options
author | Ruslan Ermilov <ru@nginx.com> | 2013-07-25 12:46:02 +0400 |
---|---|---|
committer | Ruslan Ermilov <ru@nginx.com> | 2013-07-25 12:46:02 +0400 |
commit | 690e2b33aa7ea56f8d7796b5412c5ef4dd89f556 (patch) | |
tree | aa7d76a3b6820f51916a1033ae21369982991120 /src/core/ngx_connection.c | |
parent | 32e167e211d17a92ab7beed3cc26a6fa785749f4 (diff) |
Style: reuse one int variable in ngx_configure_listening_sockets().
No functional changes.
Diffstat (limited to 'src/core/ngx_connection.c')
-rw-r--r-- | src/core/ngx_connection.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/core/ngx_connection.c b/src/core/ngx_connection.c index 827be88db..0ef145b52 100644 --- a/src/core/ngx_connection.c +++ b/src/core/ngx_connection.c @@ -464,16 +464,13 @@ ngx_open_listening_sockets(ngx_cycle_t *cycle) void ngx_configure_listening_sockets(ngx_cycle_t *cycle) { - int keepalive; + int value; ngx_uint_t i; ngx_listening_t *ls; #if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER) struct accept_filter_arg af; #endif -#if (NGX_HAVE_DEFERRED_ACCEPT && defined TCP_DEFER_ACCEPT) - int timeout; -#endif ls = cycle->listening.elts; for (i = 0; i < cycle->listening.nelts; i++) { @@ -503,15 +500,15 @@ ngx_configure_listening_sockets(ngx_cycle_t *cycle) } if (ls[i].keepalive) { - keepalive = (ls[i].keepalive == 1) ? 1 : 0; + value = (ls[i].keepalive == 1) ? 1 : 0; if (setsockopt(ls[i].fd, SOL_SOCKET, SO_KEEPALIVE, - (const void *) &keepalive, sizeof(int)) + (const void *) &value, sizeof(int)) == -1) { ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno, "setsockopt(SO_KEEPALIVE, %d) %V failed, ignored", - keepalive, &ls[i].addr_text); + value, &ls[i].addr_text); } } @@ -648,20 +645,20 @@ ngx_configure_listening_sockets(ngx_cycle_t *cycle) if (ls[i].add_deferred || ls[i].delete_deferred) { if (ls[i].add_deferred) { - timeout = (int) (ls[i].post_accept_timeout / 1000); + value = (int) (ls[i].post_accept_timeout / 1000); } else { - timeout = 0; + value = 0; } if (setsockopt(ls[i].fd, IPPROTO_TCP, TCP_DEFER_ACCEPT, - &timeout, sizeof(int)) + &value, sizeof(int)) == -1) { ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, "setsockopt(TCP_DEFER_ACCEPT, %d) for %V failed, " "ignored", - timeout, &ls[i].addr_text); + value, &ls[i].addr_text); continue; } |