From 3a6169261839eccbfc42cb75678dba69b927a330 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com> Date: Fri, 17 Nov 2017 02:10:14 +0100 Subject: [PATCH] net: set MSG_NOSIGNAL if possible --- src/network_engine.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/network_engine.cpp b/src/network_engine.cpp index 93a6cf88..4d560281 100644 --- a/src/network_engine.cpp +++ b/src/network_engine.cpp @@ -218,7 +218,8 @@ NetworkEngine::requestStep(Sp<Request> sreq) node.getAddr()); if (err == ENETUNREACH || err == EHOSTUNREACH || - err == EAFNOSUPPORT) + err == EAFNOSUPPORT || + err == EPIPE) { node.setExpired(); if (not node.id) @@ -582,6 +583,9 @@ NetworkEngine::send(const char *buf, size_t len, int flags, const SockAddr& addr if (s < 0) return EAFNOSUPPORT; +#ifdef MSG_NOSIGNAL + flags &= MSG_NOSIGNAL; +#endif if (sendto(s, buf, len, flags, addr.get(), addr.getLength()) == -1) { int err = errno; DHT_LOG.e("Can't send message to %s: %s", addr.toString().c_str(), strerror(err)); -- GitLab