summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-08-15 21:25:58 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-08-15 21:25:58 +0000
commit8eb405767d509b3625ccbdf2474722c0dd566f6e (patch)
treea1316705d32e26ff52c30fff4a0d9a89148ba904
parent8cebdce0933438c32fc5821dd16d090ea06fd8cc (diff)
This is now correct.
No win32 #ifdefs in the base class, being as IOCPEngine is only built on windows we can put the code here without the need for ifdef. The original check in socketengine_iocp was broken, copied burlex's fixed version into the child class git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7724 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/socketengine.cpp14
-rw-r--r--src/socketengine_iocp.cpp13
2 files changed, 7 insertions, 20 deletions
diff --git a/src/socketengine.cpp b/src/socketengine.cpp
index 3aef464e6..28ba8c252 100644
--- a/src/socketengine.cpp
+++ b/src/socketengine.cpp
@@ -93,24 +93,10 @@ std::string SocketEngine::GetName()
bool SocketEngine::BoundsCheckFd(EventHandler* eh)
{
-#ifdef WINDOWS
- int * internal_fd;
- if(!eh || eh->GetFd() < 0)
- return false;
-
- if(!eh->GetExt("internal_fd", internal_fd))
- return false;
-
- if(*internal_fd > MAX_DESCRIPTORS)
- return false;
-
- return true;
-#else
if (!eh)
return false;
if ((eh->GetFd() < 0) || (eh->GetFd() > MAX_DESCRIPTORS))
return false;
return true;
-#endif
}
diff --git a/src/socketengine_iocp.cpp b/src/socketengine_iocp.cpp
index 3581904ed..4eb9f83cd 100644
--- a/src/socketengine_iocp.cpp
+++ b/src/socketengine_iocp.cpp
@@ -456,15 +456,16 @@ bool IOCPEngine::HasFd(int fd)
bool IOCPEngine::BoundsCheckFd(EventHandler* eh)
{
- int* fake_fd = NULL;
- if (!eh)
- return false;
- if (!eh->GetExt("internal_fd", fake_fd))
+ int * internal_fd;
+ if (!eh || eh->GetFd() < 0)
return false;
- if ((*fake_fd < 0) || (*fake_fd > MAX_DESCRIPTORS))
+
+ if(!eh->GetExt("internal_fd", internal_fd))
return false;
- if ((eh->GetFd() < 0) || (eh->GetFd() > MAX_DESCRIPTORS))
+
+ if(*internal_fd > MAX_DESCRIPTORS)
return false;
+
return true;
}