#ifdef HAVE_WINSOCK2_H
# define OC_SOCKET_ERROR SOCKET_ERROR
# define OC_INVALID_SOCKET INVALID_SOCKET
-typedef HANDLE CASocketFd_t;
+typedef SOCKET CASocketFd_t;
#else // HAVE_WINSOCK2_H
# define OC_SOCKET_ERROR (-1)
# define OC_INVALID_SOCKET (-1)
PUSH_IP_SOCKET(m4, eventArray, socketArray, arraySize);
PUSH_IP_SOCKET(m4s, eventArray, socketArray, arraySize);
- if (-1 != caglobals.ip.shutdownEvent)
+ if (WSA_INVALID_EVENT != caglobals.ip.shutdownEvent)
{
INSERT_SOCKET(OC_INVALID_SOCKET, socketArray, arraySize);
PUSH_HANDLE(caglobals.ip.shutdownEvent, eventArray, arraySize);
}
// Break out if shutdownEvent is triggered
- if ((caglobals.ip.shutdownEvent != -1) &&
+ if ((caglobals.ip.shutdownEvent != WSA_INVALID_EVENT) &&
(caglobals.ip.shutdownEvent == eventArray[eventIndex]))
{
break;
if (caglobals.ip.terminate)
{
- caglobals.ip.shutdownEvent = -1;
+ caglobals.ip.shutdownEvent = WSA_INVALID_EVENT;
WSACleanup();
}
}
}
WSABUF iov = {.len = sizeof (recvBuffer), .buf = recvBuffer};
- WSAMSG msg = {.name = &srcAddr,
+ WSAMSG msg = {.name = (PSOCKADDR)&srcAddr,
.namelen = namelen,
.lpBuffers = &iov,
.dwBufferCount = 1,
caglobals.ip.selectTimeout = -1; // don't poll for shutdown
int ret = -1;
#if defined(WSA_WAIT_EVENT_0)
- caglobals.ip.shutdownEvent = -1;
caglobals.ip.shutdownEvent = WSACreateEvent();
-
- if (caglobals.ip.shutdownEvent == WSA_INVALID_EVENT)
- {
- caglobals.ip.shutdownEvent = -1;
- }
- else
+ if (WSA_INVALID_EVENT != caglobals.ip.shutdownEvent)
{
ret = 0;
}