setsockopt(s,IPPROTO_TCP,TCP_NODELAY,...) returns -1 as if it has failed, but errno == 0. This occurs on an IPv4 socket, newly accepted by:
It appears that the setsockopt() call has succeeded because there seems to be some improvement in the http server performance after the call.
This is probably not be related.
On FreeBSD 9.3 it returns -1 and errno=22 (EINVAL) for me in passenger:
Ser/Server.h:655: [ApiServer] Cannot disable Nagle's algorithm on a TCP socket: Invalid argument (errno=22)
if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &flag, sizeof(int)) == -1
&& errno != ENOPROTOOPT
&& errno != ENOTSUP
&& errno != EXTENSION_EOPNOTSUPP)
int e = errno;
SKS_WARN("Cannot disable Nagle's algorithm on a TCP socket: " <<
strerror(e) << " (errno=" << e << ")");
(In reply to Marián Černý from comment #1)
If fd is not a TCP socket, but a UNIX domain socket, this is expected behaviour. Since the code handles TCP and UNIX domain sockets, I guess this is what happens. If I'm wrong and this still happens on a FreeBSD version, which is supported, please reopen the issue.
(In reply to Warren Gay from comment #0)
I don't see a way of indicating an error and having disabled the Nagle algorithm. I would like to see the application code. I'm closing this, since this report is for a FreeBSD version, which is not supported anymore. If the problem persists on a supported version, please reopen and I'll be happy to debug the issue.