Fixes coverity warnings in the udp_transport module.
BUG=Coverity warnings. TEST=N/A. Review URL: https://webrtc-codereview.appspot.com/392012 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1696 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
6b9253eb4f
commit
05e0601160
@ -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
|
* 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
|
* 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);
|
_socket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Non-blocking mode
|
// Set socket to nonblocking mode.
|
||||||
int iMode = 1;
|
int enable_non_blocking = 1;
|
||||||
ioctl(_socket, FIONBIO, &iMode);
|
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
|
// Enable close on fork for file descriptor so that it will not block until
|
||||||
// forked process terminates.
|
// 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()
|
UdpSocketPosix::~UdpSocketPosix()
|
||||||
|
@ -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
|
* 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
|
* 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
|
#define FD_SETSIZE 1024
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
UdpSocketWrapper::UdpSocketWrapper() : _deleteEvent(NULL)
|
UdpSocketWrapper::UdpSocketWrapper()
|
||||||
|
: _wantsIncoming(false),
|
||||||
|
_deleteEvent(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2555,6 +2555,10 @@ WebRtc_Word32 UdpTransport::LocalHostAddressIPV6(WebRtc_UWord8 n_localIP[16])
|
|||||||
struct in6_addr* in6p;
|
struct in6_addr* in6p;
|
||||||
|
|
||||||
int fd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE);
|
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
|
// 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
|
// table. Populate the msg structure (req) the size of the message buffer
|
||||||
|
@ -219,7 +219,6 @@ private:
|
|||||||
SocketAddress _localRTCPAddr;
|
SocketAddress _localRTCPAddr;
|
||||||
|
|
||||||
WebRtc_Word32 _tos;
|
WebRtc_Word32 _tos;
|
||||||
bool _inCallbackMode;
|
|
||||||
bool _receiving;
|
bool _receiving;
|
||||||
bool _useSetSockOpt;
|
bool _useSetSockOpt;
|
||||||
bool _qos;
|
bool _qos;
|
||||||
|
Loading…
Reference in New Issue
Block a user