diff options
author | Youness Alaoui <youness.alaoui@collabora.co.uk> | 2010-07-20 17:46:56 -0400 |
---|---|---|
committer | Youness Alaoui <youness.alaoui@collabora.co.uk> | 2010-07-20 17:46:56 -0400 |
commit | 358a999fd2a1f0fa283156e088f26a69b3efa8cc (patch) | |
tree | 98b2f06dee1d269b8ce8aeebd6a4344253dac0d8 /socket/tcp-bsd.c | |
parent | 7b221116d0317f22a76a260a579fbc889c8ab32c (diff) | |
parent | e2a118f74dde5c9d57f66fe67aa9d5f4bb8f3b32 (diff) | |
download | libnice-358a999fd2a1f0fa283156e088f26a69b3efa8cc.tar.gz |
Merge remote branch 'tester/ipv6' into nice-kakaroto
Diffstat (limited to 'socket/tcp-bsd.c')
-rw-r--r-- | socket/tcp-bsd.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/socket/tcp-bsd.c b/socket/tcp-bsd.c index bcc87be..681f1b7 100644 --- a/socket/tcp-bsd.c +++ b/socket/tcp-bsd.c @@ -101,14 +101,20 @@ nice_tcp_bsd_socket_new (NiceAgent *agent, GMainContext *ctx, NiceAddress *addr) nice_address_copy_to_sockaddr(addr, (struct sockaddr *)&name); - if ((sockfd == -1) && - ((name.ss_family == AF_UNSPEC) || - (name.ss_family == AF_INET))) { - sockfd = socket (PF_INET, SOCK_STREAM, 0); - name.ss_family = AF_INET; + if (sockfd == -1) { + if (name.ss_family == AF_UNSPEC || name.ss_family == AF_INET) { + sockfd = socket (PF_INET, SOCK_STREAM, 0); + name.ss_family = AF_INET; +#ifdef HAVE_SA_LEN + name.ss_len = sizeof (struct sockaddr_in); +#endif + } else if (name.ss_family == AF_INET6) { + sockfd = socket (PF_INET6, SOCK_STREAM, 0); + name.ss_family = AF_INET6; #ifdef HAVE_SA_LEN - name.ss_len = sizeof (struct sockaddr_in); + name.ss_len = sizeof (struct sockaddr_in6); #endif + } } if (sockfd == -1) { |