Skip to content
Snippets Groups Projects
Commit 3a616926 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

net: set MSG_NOSIGNAL if possible

parent 6f9afac0
No related branches found
No related tags found
No related merge requests found
...@@ -218,7 +218,8 @@ NetworkEngine::requestStep(Sp<Request> sreq) ...@@ -218,7 +218,8 @@ NetworkEngine::requestStep(Sp<Request> sreq)
node.getAddr()); node.getAddr());
if (err == ENETUNREACH || if (err == ENETUNREACH ||
err == EHOSTUNREACH || err == EHOSTUNREACH ||
err == EAFNOSUPPORT) err == EAFNOSUPPORT ||
err == EPIPE)
{ {
node.setExpired(); node.setExpired();
if (not node.id) if (not node.id)
...@@ -582,6 +583,9 @@ NetworkEngine::send(const char *buf, size_t len, int flags, const SockAddr& addr ...@@ -582,6 +583,9 @@ NetworkEngine::send(const char *buf, size_t len, int flags, const SockAddr& addr
if (s < 0) if (s < 0)
return EAFNOSUPPORT; return EAFNOSUPPORT;
#ifdef MSG_NOSIGNAL
flags &= MSG_NOSIGNAL;
#endif
if (sendto(s, buf, len, flags, addr.get(), addr.getLength()) == -1) { if (sendto(s, buf, len, flags, addr.get(), addr.getLength()) == -1) {
int err = errno; int err = errno;
DHT_LOG.e("Can't send message to %s: %s", addr.toString().c_str(), strerror(err)); DHT_LOG.e("Can't send message to %s: %s", addr.toString().c_str(), strerror(err));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment