@@ -51,7 +51,6 @@ modified by
5151*****************************************************************************/
5252
5353#include " platform_sys.h"
54-
5554#include < iostream>
5655#include < iomanip> // Logging
5756#include < srt_compat.h>
@@ -189,6 +188,7 @@ void srt::CChannel::createSocket(int family)
189188 m_iSocket = ::socket (family, SOCK_DGRAM, IPPROTO_UDP);
190189 cloexec_flag = true ;
191190#endif
191+
192192#else // ENABLE_SOCK_CLOEXEC
193193 m_iSocket = ::socket (family, SOCK_DGRAM, IPPROTO_UDP);
194194#endif // ENABLE_SOCK_CLOEXEC
@@ -197,17 +197,18 @@ void srt::CChannel::createSocket(int family)
197197 throw CUDTException (MJ_SETUP, MN_NONE, NET_ERROR);
198198
199199#if ENABLE_SOCK_CLOEXEC
200- #ifdef _WIN32
201- // XXX ::SetHandleInformation(hInputWrite, HANDLE_FLAG_INHERIT, 0)
202- #else
200+
203201 if (cloexec_flag)
204202 {
203+ #ifdef _WIN32
204+ // XXX ::SetHandleInformation(hInputWrite, HANDLE_FLAG_INHERIT, 0)
205+ #else
205206 if (0 != set_cloexec (m_iSocket, 1 ))
206207 {
207208 throw CUDTException (MJ_SETUP, MN_NONE, NET_ERROR);
208209 }
210+ #endif // _WIN32
209211 }
210- #endif
211212#endif // ENABLE_SOCK_CLOEXEC
212213
213214 if ((m_mcfg.iIpV6Only != -1 ) && (family == AF_INET6)) // (not an error if it fails)
@@ -795,8 +796,8 @@ int srt::CChannel::sendto(const sockaddr_any& addr, CPacket& packet, const socka
795796 {
796797 if (NET_ERROR == WSA_IO_PENDING)
797798 {
798- res = WSAWaitForMultipleEvents (1 , &m_SendOverlapped.hEvent , TRUE , 100 /* ms*/ , FALSE );
799- if (res == WAIT_FAILED)
799+ DWORD res_wait = WSAWaitForMultipleEvents (1 , &m_SendOverlapped.hEvent , TRUE , 100 /* ms*/ , FALSE );
800+ if (res_wait == WAIT_FAILED)
800801 {
801802 LOGC (kslog.Warn , log << " CChannel::WSAWaitForMultipleEvents: failed with " << NET_ERROR);
802803 res = -1 ;
0 commit comments