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

Unified Diff: webrtc/base/physicalsocketserver.cc

Issue 2903313002: Disable SIGPIPE for sockets created on iOS. (Closed)
Patch Set: Adding more information to comment. Created 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/physicalsocketserver.cc
diff --git a/webrtc/base/physicalsocketserver.cc b/webrtc/base/physicalsocketserver.cc
index a412703015e77f903b82c6126edd21a4c00a023d..4ab33fb673a1154e01a3eb58f45d136a4f9fd523 100644
--- a/webrtc/base/physicalsocketserver.cc
+++ b/webrtc/base/physicalsocketserver.cc
@@ -609,6 +609,15 @@ bool SocketDispatcher::Initialize() {
#elif defined(WEBRTC_POSIX)
fcntl(s_, F_SETFL, fcntl(s_, F_GETFL, 0) | O_NONBLOCK);
#endif
+#if defined(WEBRTC_IOS)
+ // iOS may kill sockets when the app is moved to the background
+ // (specifically, if the app doesn't use the "voip" UIBackgroundMode). When
+ // we attempt to write to such a socket, SIGPIPE will be raised, which by
+ // default will terminate the process, which we don't want. By specifying
+ // this socket option, SIGPIPE will be disabled for the socket.
+ int value = 1;
+ ::setsockopt(s_, SOL_SOCKET, SO_NOSIGPIPE, &value, sizeof(value));
+#endif
ss_->Add(this);
return true;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698