]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: ostream-file: Don't log any errors when setting TCP_NODELAY
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 15 Jul 2019 07:14:23 +0000 (10:14 +0300)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 18 Jul 2019 10:50:49 +0000 (13:50 +0300)
It's likely never useful to log the error, and it seems more and more
unexpected errors just keep popping up.

src/lib/ostream-file.c

index e7e6f62d127c43fcaeddf875d260ad5f2a74a8c8..82bf729ac0094a0cc30ffdd98eafac50e07aedac 100644 (file)
@@ -333,17 +333,17 @@ static int buffer_flush(struct file_ostream *fstream)
 static void o_stream_tcp_flush_via_nodelay(struct file_ostream *fstream)
 {
        if (net_set_tcp_nodelay(fstream->fd, TRUE) < 0) {
-               if (errno != ENOTSUP && errno != ENOTSOCK &&
-                   errno != ENOPROTOOPT) {
-                       i_error("file_ostream.net_set_tcp_nodelay(%s, TRUE) failed: %m",
-                               o_stream_get_name(&fstream->ostream.ostream));
-               }
+               /* Don't bother logging errors. There are quite a lot of
+                  different errors that need to be ignored, and it differs
+                  between OSes. At least:
+                  Linux: ENOTSUP, ENOTSOCK, ENOPROTOOPT
+                  FreeBSD: EINVAL, ECONNRESET */
                fstream->no_socket_nodelay = TRUE;
        } else if (net_set_tcp_nodelay(fstream->fd, FALSE) < 0) {
-               /* We already successfully enabled TCP_NODELAY, so we're really
-                  not expecting any errors here. */
-               i_error("file_ostream.net_set_tcp_nodelay(%s, FALSE) failed: %m",
-                       o_stream_get_name(&fstream->ostream.ostream));
+               /* We already successfully enabled TCP_NODELAY, so there
+                  shouldn't really be errors. Except ECONNRESET can possibly
+                  still happen between these two calls, so again don't log
+                  errors. */
                fstream->no_socket_nodelay = TRUE;
        }
 }