]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/socket.cpp
Regressed buffering code
[user/henk/code/inspircd.git] / src / socket.cpp
index 2868375a51a8ca5b47883103acf93599ab89e1a9..20a447ba74e6208d4902287c4bd793f0ea2a605f 100644 (file)
@@ -76,7 +76,7 @@ InspSocket::InspSocket(const std::string &ahost, int aport, bool listening, unsi
                }
                else
                {
-                       if (BindSocket(this->fd,this->client,this->server,aport,(char*)ahost.c_str()) == ERROR)
+                       if (!BindSocket(this->fd,this->client,this->server,aport,(char*)ahost.c_str()))
                        {
                                this->Close();
                                this->fd = -1;
@@ -257,15 +257,15 @@ int InspSocket::Write(const std::string &data)
        if (this->ClosePending)
                return false;
 
-       int result = write(this->fd,data.c_str(),data.length());
+       /*int result = write(this->fd,data.c_str(),data.length());
        if (result < 1)
                return false;
-       return true;
+       return true;*/
 
        /* Try and append the data to the back of the queue, and send it on its way
         */
-       //outbuffer.push_back(data);
-       //return (!this->FlushWriteBuffer());
+       outbuffer.push_back(data);
+       return (!this->FlushWriteBuffer());
 }
 
 bool InspSocket::FlushWriteBuffer()
@@ -273,7 +273,7 @@ bool InspSocket::FlushWriteBuffer()
        if (this->ClosePending)
                return true;
 
-       /*if ((this->fd > -1) && (this->state == I_CONNECTED))
+       if ((this->fd > -1) && (this->state == I_CONNECTED))
        {
                if (outbuffer.size())
                {
@@ -284,9 +284,9 @@ bool InspSocket::FlushWriteBuffer()
                                log(DEBUG,"Wrote %d to socket",result);
                                if ((unsigned int)result == outbuffer[0].length())
                                {
-                                        * The whole block was written (usually a line)
+                                       /* The whole block was written (usually a line)
                                         * Pop the block off the front of the queue
-                                        *
+                                        */
                                        log(DEBUG,"Popping front item, now %d items left",outbuffer.size());
                                        outbuffer.pop_front();
                                }
@@ -306,7 +306,7 @@ bool InspSocket::FlushWriteBuffer()
                                return true;
                        }
                }
-       }*/
+       }
        return false;
 }