X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Finspsocket.cpp;h=96f07b6e40f8502f4da364ddff7a2b0c21de29c7;hb=bb35a0fa9cbebe51fa636f707c12ca4a7033dd9a;hp=edb58a05c7e74a19713b509212f465856036f245;hpb=480e1e9e1ff6c39a154f3efc6e83b0ffc94a6c8d;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp index edb58a05c..96f07b6e4 100644 --- a/src/inspsocket.cpp +++ b/src/inspsocket.cpp @@ -378,11 +378,7 @@ std::string InspSocket::GetIP() char* InspSocket::Read() { -#ifdef WINDOWS - if ((fd < 0) || (m_internalFd > MAX_DESCRIPTORS)) -#else - if ((fd < 0) || (fd > MAX_DESCRIPTORS)) -#endif + if (!Instance->SE->BoundsCheckFd(this)) return NULL; int n = 0; @@ -556,19 +552,16 @@ void SocketTimeout::Tick(time_t now) bool InspSocket::Poll() { -#ifdef WINDOWS - if(Instance->SE->GetRef(this->fd) != this) - return false; - int incoming = -1; -#else - if (this->Instance->SE->GetRef(this->fd) != this) - return false; - int incoming = -1; - if ((fd < 0) || (fd > MAX_DESCRIPTORS)) +#ifndef WINDOWS + if (!Instance->SE->BoundsCheckFd(this)) return false; #endif + + if (Instance->SE->GetRef(this->fd) != this) + return false; + switch (this->state) { case I_CONNECTING: @@ -579,14 +572,12 @@ bool InspSocket::Poll() if (this->fd > -1) { this->Instance->SE->DelFd(this); - this->SetState(I_CONNECTED); if (!this->Instance->SE->AddFd(this)) return false; } -#else - this->SetState(I_CONNECTED); #endif - Instance->Log(DEBUG,"Inspsocket I_CONNECTING state"); + this->SetState(I_CONNECTED); + if (Instance->Config->GetIOHook(this)) { Instance->Log(DEBUG,"Hook for raw connect"); @@ -610,6 +601,8 @@ bool InspSocket::Poll() if ((!*this->host) || strchr(this->host, ':')) length = sizeof(sockaddr_in6); #endif + void* m_acceptEvent = NULL; + GetExt("windows_acceptevent", m_acceptEvent); incoming = _accept (this->fd, client, &length); #ifdef IPV6 if ((!*this->host) || strchr(this->host, ':'))