]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Squelch log messages from tcp send about connection reset by peer.
authorW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Mon, 13 May 2019 08:39:39 +0000 (10:39 +0200)
committerW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Mon, 13 May 2019 08:39:39 +0000 (10:39 +0200)
  They can be enabled with verbosity at higher values for diagnosing
  network connectivity issues.

doc/Changelog
util/netevent.c

index fb5ee2423d9f4567492e45b3e88bca102322011b..a08eb8a32d399426b861c102af72611dd4c3e5c7 100644 (file)
@@ -1,3 +1,8 @@
+13 May 2019: Wouter
+       - Squelch log messages from tcp send about connection reset by peer.
+         They can be enabled with verbosity at higher values for diagnosing
+         network connectivity issues.
+
 9 May 2019: Wouter
        - Revert fix for oss-fuzz, error is in that build script that
          unconditionally includes .o files detected by configure, also
index b8b2a09005eb1f3ff02a97ae056b227ca26d2e7d..665b5b0d2523caed5c0f1fab9670e573a6c38d69 100644 (file)
@@ -1648,6 +1648,10 @@ comm_point_tcp_handle_write(int fd, struct comm_point* c)
   #endif
                        if(errno == EINTR || errno == EAGAIN)
                                return 1;
+#ifdef ECONNRESET
+                       if(errno == ECONNRESET && verbosity < 2)
+                               return 0; /* silence reset by peer */
+#endif
 #  ifdef HAVE_WRITEV
                        log_err_addr("tcp writev", strerror(errno),
                                &c->repinfo.addr, c->repinfo.addrlen);
@@ -1665,6 +1669,8 @@ comm_point_tcp_handle_write(int fd, struct comm_point* c)
                                        UB_EV_WRITE);
                                return 1; 
                        }
+                       if(WSAGetLastError() == WSAECONNRESET && verbosity < 2)
+                               return 0; /* silence reset by peer */
                        log_err_addr("tcp send s",
                                wsa_strerror(WSAGetLastError()),
                                &c->repinfo.addr, c->repinfo.addrlen);
@@ -1688,6 +1694,10 @@ comm_point_tcp_handle_write(int fd, struct comm_point* c)
 #ifndef USE_WINSOCK
                if(errno == EINTR || errno == EAGAIN)
                        return 1;
+#ifdef ECONNRESET
+               if(errno == ECONNRESET && verbosity < 2)
+                       return 0; /* silence reset by peer */
+#endif
                log_err_addr("tcp send r", strerror(errno),
                        &c->repinfo.addr, c->repinfo.addrlen);
 #else
@@ -1697,6 +1707,8 @@ comm_point_tcp_handle_write(int fd, struct comm_point* c)
                        ub_winsock_tcp_wouldblock(c->ev->ev, UB_EV_WRITE);
                        return 1; 
                }
+               if(WSAGetLastError() == WSAECONNRESET && verbosity < 2)
+                       return 0; /* silence reset by peer */
                log_err_addr("tcp send r", wsa_strerror(WSAGetLastError()),
                        &c->repinfo.addr, c->repinfo.addrlen);
 #endif