| 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;
|
| }
|
|
|