]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Re-enterance safety
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Sat, 11 Mar 2006 17:27:20 +0000 (17:27 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Sat, 11 Mar 2006 17:27:20 +0000 (17:27 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3665 e03df62e-2008-0410-955e-edbf42e46eb7

src/socket.cpp
src/svn-rev.sh

index d4cdb0a18f41903510d1732596da69ac84af47a7..f4e6a5a6a7e4369d41640cac1fd1398e1d8883e6 100644 (file)
@@ -147,6 +147,7 @@ bool InspSocket::DoResolve()
                        this->Close();
                        this->state = I_ERROR;
                        this->OnError(I_ERR_RESOLVE);
+                       this->fd = -1;
                        return false;
                }
                return this->DoConnect();
@@ -163,6 +164,7 @@ bool InspSocket::DoConnect()
                log(DEBUG,"Cant socket()");
                this->state = I_ERROR;
                this->OnError(I_ERR_SOCKET);
+               this->fd = -1;
                return false;
        }
 
@@ -184,6 +186,7 @@ bool InspSocket::DoConnect()
                        this->OnError(I_ERR_CONNECT);
                        this->state = I_ERROR;
                        this->Close();
+                       this->fd = -1;
                        return false;
                }
        }
@@ -275,6 +278,7 @@ bool InspSocket::FlushWriteBuffer()
                                log(DEBUG,"Write error on socket: %s",strerror(errno));
                                this->OnError(I_ERR_WRITE);
                                this->state = I_ERROR;
+                               this->fd = -1;
                                return true;
                        }
                }
@@ -295,6 +299,7 @@ bool InspSocket::Timeout(time_t current)
                this->OnError(I_ERR_TIMEOUT);
                timeout = true;
                this->state = I_ERROR;
+               this->fd = -1;
                return true;
        }
        return this->FlushWriteBuffer();
@@ -305,6 +310,9 @@ bool InspSocket::Poll()
        int incoming = -1;
        bool n = true;
 
+       if ((fd < 0) || (fd > MAX_DESCRIPTORS))
+               return false;
+
        switch (this->state)
        {
                case I_RESOLVING:
index 846663619694521606dc0ab7e490fbe819adb718..5e819f84a086e8b9882c684a3c73f045a6296bc1 100755 (executable)
@@ -1 +1 @@
-echo 3661
+echo 3664