]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/inspsocket.cpp
Fix small typo found by danieldg
[user/henk/code/inspircd.git] / src / inspsocket.cpp
index edb58a05c7e74a19713b509212f465856036f245..96f07b6e40f8502f4da364ddff7a2b0c21de29c7 100644 (file)
@@ -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, ':'))