[nginx] Syslog: re-open syslog udp socket on send error (ticket #1477).

Vladimir Homutov vl at nginx.com
Tue May 8 17:05:30 UTC 2018


details:   http://hg.nginx.org/nginx/rev/fa0e093b64d7
branches:  
changeset: 7272:fa0e093b64d7
user:      Vladimir Homutov <vl at nginx.com>
date:      Tue May 08 19:35:56 2018 +0300
description:
Syslog: re-open syslog udp socket on send error (ticket #1477).

Previously, only unix domain sockets were reopened to tolerate cases when
local syslog server was restarted.  It makes sense to treat other cases
(for example, local IP address changes) similarly.

diffstat:

 src/core/ngx_syslog.c |  6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)

diffs (23 lines):

diff -r 9e25a5380a21 -r fa0e093b64d7 src/core/ngx_syslog.c
--- a/src/core/ngx_syslog.c	Mon May 07 09:54:37 2018 +0000
+++ b/src/core/ngx_syslog.c	Tue May 08 19:35:56 2018 +0300
@@ -289,9 +289,7 @@ ngx_syslog_send(ngx_syslog_peer_t *peer,
         n = ngx_os_io.send(&peer->conn, buf, len);
     }
 
-#if (NGX_HAVE_UNIX_DOMAIN)
-
-    if (n == NGX_ERROR && peer->server.sockaddr->sa_family == AF_UNIX) {
+    if (n == NGX_ERROR) {
 
         if (ngx_close_socket(peer->conn.fd) == -1) {
             ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, ngx_socket_errno,
@@ -301,8 +299,6 @@ ngx_syslog_send(ngx_syslog_peer_t *peer,
         peer->conn.fd = (ngx_socket_t) -1;
     }
 
-#endif
-
     return n;
 }
 


More information about the nginx-devel mailing list