From 84f96a2fd57592b5bbd0ee72bc677bc76c089df7 Mon Sep 17 00:00:00 2001 From: Janusz Dziemidowicz Date: Wed, 23 Sep 2015 12:22:34 +0200 Subject: [PATCH] Do not try to set TCP_NODELAY when frontend is an UNIX socket This silences warning log that otherwise spams logs on every accepted connection. --- src/shrpx_ssl.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/shrpx_ssl.cc b/src/shrpx_ssl.cc index c4f32ee4..aa35d50c 100644 --- a/src/shrpx_ssl.cc +++ b/src/shrpx_ssl.cc @@ -721,11 +721,11 @@ ClientHandler *accept_connection(Worker *worker, int fd, sockaddr *addr, return nullptr; } - int val = 1; - rv = setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, reinterpret_cast(&val), - sizeof(val)); - if (rv == -1) { - LOG(WARN) << "Setting option TCP_NODELAY failed: errno=" << errno; + if (addr->sa_family != AF_UNIX) { + rv = util::make_socket_nodelay(fd); + if (rv == -1) { + LOG(WARN) << "Setting option TCP_NODELAY failed: errno=" << errno; + } } SSL *ssl = nullptr; auto ssl_ctx = worker->get_sv_ssl_ctx();