diff --git a/src/modules/udp_transport/source/udp_socket_posix.cc b/src/modules/udp_transport/source/udp_socket_posix.cc index 6308f9f4a..9d3564d59 100644 --- a/src/modules/udp_transport/source/udp_socket_posix.cc +++ b/src/modules/udp_transport/source/udp_socket_posix.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. + * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source @@ -52,12 +52,20 @@ UdpSocketPosix::UdpSocketPosix(const WebRtc_Word32 id, UdpSocketManager* mgr, _socket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); } - // Non-blocking mode - int iMode = 1; - ioctl(_socket, FIONBIO, &iMode); + // Set socket to nonblocking mode. + int enable_non_blocking = 1; + if(ioctl(_socket, FIONBIO, &enable_non_blocking) == -1) + { + WEBRTC_TRACE(kTraceWarning, kTraceTransport, id, + "Failed to make socket nonblocking"); + } // Enable close on fork for file descriptor so that it will not block until // forked process terminates. - fcntl(_socket,F_SETFD,FD_CLOEXEC); + if(fcntl(_socket, F_SETFD, FD_CLOEXEC) == -1) + { + WEBRTC_TRACE(kTraceWarning, kTraceTransport, id, + "Failed to set FD_CLOEXEC for socket"); + } } UdpSocketPosix::~UdpSocketPosix() diff --git a/src/modules/udp_transport/source/udp_socket_wrapper.cc b/src/modules/udp_transport/source/udp_socket_wrapper.cc index 180682be0..53093a1e2 100644 --- a/src/modules/udp_transport/source/udp_socket_wrapper.cc +++ b/src/modules/udp_transport/source/udp_socket_wrapper.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. + * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source @@ -35,7 +35,9 @@ bool UdpSocketWrapper::_initiated = false; #define FD_SETSIZE 1024 #endif -UdpSocketWrapper::UdpSocketWrapper() : _deleteEvent(NULL) +UdpSocketWrapper::UdpSocketWrapper() + : _wantsIncoming(false), + _deleteEvent(NULL) { } diff --git a/src/modules/udp_transport/source/udp_transport_impl.cc b/src/modules/udp_transport/source/udp_transport_impl.cc index 7df0af349..cfc04874b 100644 --- a/src/modules/udp_transport/source/udp_transport_impl.cc +++ b/src/modules/udp_transport/source/udp_transport_impl.cc @@ -2555,6 +2555,10 @@ WebRtc_Word32 UdpTransport::LocalHostAddressIPV6(WebRtc_UWord8 n_localIP[16]) struct in6_addr* in6p; int fd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE); + if (fd == -1) + { + return -1; + } // RTM_GETADDR is used to fetch the ip address from the kernel interface // table. Populate the msg structure (req) the size of the message buffer diff --git a/src/modules/udp_transport/source/udp_transport_impl.h b/src/modules/udp_transport/source/udp_transport_impl.h index 52a34bd49..de66c0811 100644 --- a/src/modules/udp_transport/source/udp_transport_impl.h +++ b/src/modules/udp_transport/source/udp_transport_impl.h @@ -219,7 +219,6 @@ private: SocketAddress _localRTCPAddr; WebRtc_Word32 _tos; - bool _inCallbackMode; bool _receiving; bool _useSetSockOpt; bool _qos;