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.
This commit is contained in:
Janusz Dziemidowicz 2015-09-23 12:22:34 +02:00
parent 87a38bdf8d
commit 84f96a2fd5
1 changed files with 5 additions and 5 deletions

View File

@ -721,11 +721,11 @@ ClientHandler *accept_connection(Worker *worker, int fd, sockaddr *addr,
return nullptr; return nullptr;
} }
int val = 1; if (addr->sa_family != AF_UNIX) {
rv = setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, reinterpret_cast<char *>(&val), rv = util::make_socket_nodelay(fd);
sizeof(val)); if (rv == -1) {
if (rv == -1) { LOG(WARN) << "Setting option TCP_NODELAY failed: errno=" << errno;
LOG(WARN) << "Setting option TCP_NODELAY failed: errno=" << errno; }
} }
SSL *ssl = nullptr; SSL *ssl = nullptr;
auto ssl_ctx = worker->get_sv_ssl_ctx(); auto ssl_ctx = worker->get_sv_ssl_ctx();