summaryrefslogtreecommitdiff
path: root/src/socketengine.cpp
diff options
context:
space:
mode:
authorAdam <adam@sigterm.info>2012-10-12 14:50:05 -0700
committerAdam <adam@sigterm.info>2012-10-12 14:50:05 -0700
commitc05ad37bfd03486475889485606ed5cffc7bf5a2 (patch)
treefe01825889769500a0f080371a0714aa15505b9a /src/socketengine.cpp
parente496d321efe3e9b27f2f116bd22a05ec44aec564 (diff)
parent5b9682275e384635a1fd9f7320cf4d9a604a43b4 (diff)
Merge pull request #320 from ChrisTX/insp20+cleanupwin
Windows: In-depth cleanup (see details)
Diffstat (limited to 'src/socketengine.cpp')
-rw-r--r--src/socketengine.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/socketengine.cpp b/src/socketengine.cpp
index ccaa71aed..27abd0ad6 100644
--- a/src/socketengine.cpp
+++ b/src/socketengine.cpp
@@ -98,7 +98,7 @@ bool SocketEngine::HasFd(int fd)
{
if ((fd < 0) || (fd > GetMaxFds()))
return false;
- return ref[fd];
+ return (ref[fd] != NULL);
}
EventHandler* SocketEngine::GetRef(int fd)
@@ -125,7 +125,7 @@ int SocketEngine::Accept(EventHandler* fd, sockaddr *addr, socklen_t *addrlen)
int SocketEngine::Close(EventHandler* fd)
{
-#ifdef WINDOWS
+#ifdef _WIN32
return closesocket(fd->GetFd());
#else
return close(fd->GetFd());
@@ -134,7 +134,7 @@ int SocketEngine::Close(EventHandler* fd)
int SocketEngine::Close(int fd)
{
-#ifdef WINDOWS
+#ifdef _WIN32
return closesocket(fd);
#else
return close(fd);
@@ -143,7 +143,7 @@ int SocketEngine::Close(int fd)
int SocketEngine::Blocking(int fd)
{
-#ifdef WINDOWS
+#ifdef _WIN32
unsigned long opt = 0;
return ioctlsocket(fd, FIONBIO, &opt);
#else
@@ -154,7 +154,7 @@ int SocketEngine::Blocking(int fd)
int SocketEngine::NonBlocking(int fd)
{
-#ifdef WINDOWS
+#ifdef _WIN32
unsigned long opt = 1;
return ioctlsocket(fd, FIONBIO, &opt);
#else
@@ -209,7 +209,7 @@ int SocketEngine::SendTo(EventHandler* fd, const void *buf, size_t len, int flag
int SocketEngine::Connect(EventHandler* fd, const sockaddr *serv_addr, socklen_t addrlen)
{
int ret = connect(fd->GetFd(), serv_addr, addrlen);
-#ifdef WINDOWS
+#ifdef _WIN32
if ((ret == SOCKET_ERROR) && (WSAGetLastError() == WSAEWOULDBLOCK))
errno = EINPROGRESS;
#endif