Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(541)

Unified Diff: net/socket/socket_posix.cc

Issue 2034433002: Try to tolerate running on contexts with SIGPIPE enabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« net/socket/socket_descriptor.cc ('K') | « net/socket/socket_descriptor.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/socket_posix.cc
diff --git a/net/socket/socket_posix.cc b/net/socket/socket_posix.cc
index 19d4343fa4277b53c39bfd0976d98bd5ed04c2fe..8ed912422ffa6cbddeef8c8e1e0f45463985b306 100644
--- a/net/socket/socket_posix.cc
+++ b/net/socket/socket_posix.cc
@@ -14,6 +14,7 @@
#include "base/logging.h"
#include "base/posix/eintr_wrapper.h"
#include "base/trace_event/trace_event.h"
+#include "build/build_config.h"
#include "net/base/io_buffer.h"
#include "net/base/ip_endpoint.h"
#include "net/base/net_errors.h"
@@ -441,7 +442,15 @@ void SocketPosix::ReadCompleted() {
}
int SocketPosix::DoWrite(IOBuffer* buf, int buf_len) {
+#if defined(OS_LINUX)
mmenke 2016/06/01 21:45:11 OS_LINUX excludes Android, I believe. Should we a
davidben 2016/06/01 21:50:59 Ugh, so it does. Done.
+ // Disable SIGPIPE for this write. Although Chromium globally disables
+ // SIGPIPE, the net stack may be used in other consumers which do not do
+ // this. MSG_NOSIGNAL is a Linux-only API. On OS X, this is a setsockopt on
+ // socket creation.
+ int rv = HANDLE_EINTR(send(socket_fd_, buf->data(), buf_len, MSG_NOSIGNAL));
+#else
int rv = HANDLE_EINTR(write(socket_fd_, buf->data(), buf_len));
+#endif
return rv >= 0 ? rv : MapSystemError(errno);
}
« net/socket/socket_descriptor.cc ('K') | « net/socket/socket_descriptor.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698