]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: ostream-file - Don't use TCP_CORK or TCP_NODELAY for UNIX sockets
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Fri, 17 May 2019 13:12:24 +0000 (16:12 +0300)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Fri, 17 May 2019 13:15:09 +0000 (16:15 +0300)
Either they fail or just don't do anything.

src/lib/ostream-file.c

index 3879bbe7b03189f1f3db039f2f6934f3ffccf94b..ba6bbb17008644bbba5160ed0c4b5085b36f1d79 100644 (file)
@@ -1044,10 +1044,17 @@ struct ostream * o_stream_create_fd_common(int fd, size_t max_buffer_size,
                fstream->buffer_offset = offset;
                fstream_init_file(fstream);
        } else {
-               if (net_getsockname(fd, NULL, NULL) < 0) {
+               struct ip_addr local_ip;
+
+               if (net_getsockname(fd, &local_ip, NULL) < 0) {
+                       /* not a socket */
                        fstream->no_sendfile = TRUE;
                        fstream->no_socket_cork = TRUE;
                        fstream->no_socket_nodelay = TRUE;
+               } else if (local_ip.family == 0) {
+                       /* UNIX domain socket */
+                       fstream->no_socket_cork = TRUE;
+                       fstream->no_socket_nodelay = TRUE;
                }
        }