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
This commit is contained in:
brain 2007-08-15 21:25:58 +00:00
parent 8cebdce093
commit 8eb405767d
2 changed files with 7 additions and 20 deletions

View File

@ -93,24 +93,10 @@ std::string SocketEngine::GetName()
bool SocketEngine::BoundsCheckFd(EventHandler* eh) 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) if (!eh)
return false; return false;
if ((eh->GetFd() < 0) || (eh->GetFd() > MAX_DESCRIPTORS)) if ((eh->GetFd() < 0) || (eh->GetFd() > MAX_DESCRIPTORS))
return false; return false;
return true; return true;
#endif
} }

View File

@ -456,15 +456,16 @@ bool IOCPEngine::HasFd(int fd)
bool IOCPEngine::BoundsCheckFd(EventHandler* eh) bool IOCPEngine::BoundsCheckFd(EventHandler* eh)
{ {
int* fake_fd = NULL; int * internal_fd;
if (!eh) if (!eh || eh->GetFd() < 0)
return false; return false;
if (!eh->GetExt("internal_fd", fake_fd))
if(!eh->GetExt("internal_fd", internal_fd))
return false; return false;
if ((*fake_fd < 0) || (*fake_fd > MAX_DESCRIPTORS))
return false; if(*internal_fd > MAX_DESCRIPTORS)
if ((eh->GetFd() < 0) || (eh->GetFd() > MAX_DESCRIPTORS))
return false; return false;
return true; return true;
} }