summaryrefslogtreecommitdiff
path: root/pjlib/src/pj/sock_bsd.c
diff options
context:
space:
mode:
authorLiong Sauw Ming <ming@teluu.com>2010-08-27 06:46:29 +0000
committerLiong Sauw Ming <ming@teluu.com>2010-08-27 06:46:29 +0000
commita5c285d7fd046c862ef2ba11cd8bef71786db939 (patch)
tree13247c6735d6bb8f6a4b6d5253b39dd8a4b0e6a3 /pjlib/src/pj/sock_bsd.c
parent41b2998504157f24d6b991d372e77addbed55030 (diff)
Closed ticket #1107: iOS4 background feature
* pjlib: * add support for activesock TCP to work in background mode. * add feature in ioqueue to recreate closed UDP sockets. * pjsip-apps: * ipjsua: add support for iPhone OS 4 background mode * ipjsystest: add support for iPhone OS 4 background mode git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3299 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib/src/pj/sock_bsd.c')
-rw-r--r--pjlib/src/pj/sock_bsd.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/pjlib/src/pj/sock_bsd.c b/pjlib/src/pj/sock_bsd.c
index 2551e641..aef2ff8a 100644
--- a/pjlib/src/pj/sock_bsd.c
+++ b/pjlib/src/pj/sock_bsd.c
@@ -513,12 +513,21 @@ PJ_DEF(pj_status_t) pj_sock_socket(int af,
PJ_ASSERT_RETURN(sock!=NULL, PJ_EINVAL);
PJ_ASSERT_RETURN(PJ_INVALID_SOCKET==-1,
(*sock=PJ_INVALID_SOCKET, PJ_EINVAL));
-
+
*sock = socket(af, type, proto);
if (*sock == PJ_INVALID_SOCKET)
return PJ_RETURN_OS_ERROR(pj_get_native_netos_error());
- else
+ else {
+#if defined(PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT) && \
+ PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT!=0
+ pj_int32_t val = 1;
+ if (type == pj_SOCK_DGRAM()) {
+ pj_sock_setsockopt(*sock, pj_SOL_SOCKET(), SO_NOSIGPIPE,
+ &val, sizeof(val));
+ }
+#endif
return PJ_SUCCESS;
+ }
}
#endif