]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/inspsocket.cpp
Fix this so it works, passes test case. Provide a method to query for a bit and to...
[user/henk/code/inspircd.git] / src / inspsocket.cpp
index 1e9f3eb5be14e3a60fa9e5dd78dd0a97d5276035..5f5c2d6ec2d3701f6e2cf6244b6f99b97055d8da 100644 (file)
@@ -404,7 +404,6 @@ bool InspSocket::Poll()
                return false;
 
        int incoming = -1;
-       bool n = true;
 
        if ((fd < 0) || (fd > MAX_DESCRIPTORS))
                return false;
@@ -437,18 +436,8 @@ bool InspSocket::Poll()
                        return true;
                break;
                case I_CONNECTED:
-
-                       if (this->WaitingForWriteEvent)
-                       {
-                               /* Trigger the write event */
-                               n = this->OnWriteReady();
-                       }
-                       else
-                       {
-                               /* Process the read event */
-                               n = this->OnDataReady();
-                       }
-                       return n;
+                       /* Process the read event */
+                       return this->OnDataReady();
                break;
                default:
                break;
@@ -486,10 +475,16 @@ InspSocket::~InspSocket()
        this->Close();
 }
 
-void InspSocket::HandleEvent(EventType et)
+void InspSocket::HandleEvent(EventType et, int errornum)
 {
        switch (et)
        {
+               case EVENT_ERROR:
+                       this->Instance->SE->DelFd(this);
+                       this->Close();
+                       delete this;
+                       return;
+               break;
                case EVENT_READ:
                        if (!this->Poll())
                        {
@@ -502,6 +497,7 @@ void InspSocket::HandleEvent(EventType et)
                case EVENT_WRITE:
                        if (this->WaitingForWriteEvent)
                        {
+                               this->WaitingForWriteEvent = false;
                                if (!this->OnWriteReady())
                                {
                                        this->Instance->SE->DelFd(this);
@@ -523,6 +519,7 @@ void InspSocket::HandleEvent(EventType et)
                        }
                        else
                        {
+                               Instance->Log(DEBUG,"State=%d CONNECTED=%d", this->state, I_CONNECTED);
                                if (this->FlushWriteBuffer())
                                {
                                        this->Instance->SE->DelFd(this);