From 361e99a9061a1ed2a8f72f188c8dd46859422cf3 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Sat, 5 Nov 2016 18:12:01 +0000 Subject: [PATCH] Problem: kFreeBSD might return ECONNRESET under load when destroying engine Solution: ignore it on kFreeBSD, as it is not an error Thanks Steven Chamberlain for the patch! --- src/stream_engine.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/stream_engine.cpp b/src/stream_engine.cpp index 8d2de8e5..2e57ec3c 100644 --- a/src/stream_engine.cpp +++ b/src/stream_engine.cpp @@ -156,6 +156,12 @@ zmq::stream_engine_t::~stream_engine_t () wsa_assert (rc != SOCKET_ERROR); #else int rc = close (s); +#ifdef __FreeBSD_kernel__ + // FreeBSD may return ECONNRESET on close() under load but this is not + // an error. + if (rc == -1 && errno == ECONNRESET) + rc = 0; +#endif errno_assert (rc == 0); #endif s = retired_fd;