]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/inspsocket.cpp
Remove an unused member.
[user/henk/code/inspircd.git] / src / inspsocket.cpp
index 0c3f3ea17293fbc27866ab280c68e1ebb96c9ad1..f3917bba0bc91f6e94ed3ce663eadb7dec530068 100644 (file)
@@ -20,7 +20,7 @@
 
 bool BufferedSocket::Readable()
 {
-       return ((this->state != I_CONNECTING) && (this->WaitingForWriteEvent == false));
+       return (this->state != I_CONNECTING);
 }
 
 BufferedSocket::BufferedSocket(InspIRCd* SI)
@@ -28,7 +28,6 @@ BufferedSocket::BufferedSocket(InspIRCd* SI)
        this->Timeout = NULL;
        this->state = I_DISCONNECTED;
        this->fd = -1;
-       this->WaitingForWriteEvent = false;
        this->Instance = SI;
 }
 
@@ -38,7 +37,6 @@ BufferedSocket::BufferedSocket(InspIRCd* SI, int newfd, const char* ip)
        this->fd = newfd;
        this->state = I_CONNECTED;
        strlcpy(this->IP,ip,MAXBUF);
-       this->WaitingForWriteEvent = false;
        this->Instance = SI;
        if (this->fd > -1)
                this->Instance->SE->AddFd(this);
@@ -50,7 +48,6 @@ BufferedSocket::BufferedSocket(InspIRCd* SI, const std::string &ipaddr, int apor
        this->fd = -1;
        this->Instance = SI;
        strlcpy(host,ipaddr.c_str(),MAXBUF);
-       this->WaitingForWriteEvent = false;
        this->Timeout = NULL;
 
        strlcpy(this->host,ipaddr.c_str(),MAXBUF);
@@ -98,7 +95,6 @@ BufferedSocket::BufferedSocket(InspIRCd* SI, const std::string &ipaddr, int apor
 void BufferedSocket::WantWrite()
 {
        this->Instance->SE->WantWrite(this);
-       this->WaitingForWriteEvent = true;
 }
 
 void BufferedSocket::SetQueues(int nfd)
@@ -266,11 +262,6 @@ bool BufferedSocket::DoConnect()
 
        Instance->SE->NonBlocking(this->fd);
 
-#ifdef WIN32
-       /* UGH for the LOVE OF ZOMBIE JESUS SOMEONE FIX THIS!!!!!!!!!!! */
-       Instance->SE->Blocking(this->fd);
-#endif
-
        if (Instance->SE->Connect(this, (sockaddr*)addr, size) == -1)
        {
                if (errno != EINPROGRESS)
@@ -284,10 +275,7 @@ bool BufferedSocket::DoConnect()
                this->Timeout = new SocketTimeout(this->GetFd(), this->Instance, this, timeout_val, this->Instance->Time());
                this->Instance->Timers->AddTimer(this->Timeout);
        }
-#ifdef WIN32
-       /* CRAQ SMOKING STUFF TO BE FIXED */
-       Instance->SE->NonBlocking(this->fd);
-#endif
+
        this->state = I_CONNECTING;
        if (this->fd > -1)
        {
@@ -516,7 +504,6 @@ void SocketTimeout::Tick(time_t)
                // connection.
                this->sock->OnTimeout();
                this->sock->OnError(I_ERR_TIMEOUT);
-               this->sock->timeout = true;
 
                /* NOTE: We must set this AFTER DelFd, as we added
                 * this socket whilst writeable. This means that we
@@ -595,7 +582,11 @@ bool BufferedSocket::OnConnected() { return true; }
 void BufferedSocket::OnError(BufferedSocketError) { return; }
 int BufferedSocket::OnDisconnect() { return 0; }
 bool BufferedSocket::OnDataReady() { return true; }
-bool BufferedSocket::OnWriteReady() { return true; }
+bool BufferedSocket::OnWriteReady()
+{
+       // Default behaviour: just try write some.
+       return !this->FlushWriteBuffer();
+}
 void BufferedSocket::OnTimeout() { return; }
 void BufferedSocket::OnClose() { return; }
 
@@ -644,16 +635,6 @@ void BufferedSocket::HandleEvent(EventType et, int errornum)
                        }
                break;
                case EVENT_WRITE:
-                       if (this->WaitingForWriteEvent)
-                       {
-                               this->WaitingForWriteEvent = false;
-                               if (!this->OnWriteReady())
-                               {
-                                       if (this->Instance->SocketCull.find(this) == this->Instance->SocketCull.end())
-                                               this->Instance->SocketCull[this] = this;
-                                       return;
-                               }
-                       }
                        if (this->state == I_CONNECTING)
                        {
                                /* This might look wrong as if we should be actually calling
@@ -667,7 +648,7 @@ void BufferedSocket::HandleEvent(EventType et, int errornum)
                        }
                        else
                        {
-                               if (this->FlushWriteBuffer())
+                               if (!this->OnWriteReady())
                                {
                                        if (this->Instance->SocketCull.find(this) == this->Instance->SocketCull.end())
                                                this->Instance->SocketCull[this] = this;