]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Added code to not try and increment buffer if wrote 0 chars
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Tue, 24 May 2005 17:26:22 +0000 (17:26 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Tue, 24 May 2005 17:26:22 +0000 (17:26 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1500 e03df62e-2008-0410-955e-edbf42e46eb7

src/connection.cpp

index 30a961e96f4b2ef5ba0318b8a29d303100a609b0..ce5ff3f9f359dba97cdb9b0afbe7e30ebf42fe48 100644 (file)
@@ -235,19 +235,22 @@ bool ircd_connector::FlushWriteBuf()
         {
                 char* tb = (char*)this->sendq.c_str();
                 int n_sent = write(this->fd,tb,this->sendq.length());
-                if (n_sent == -1)
-                {
-                        this->SetWriteError(strerror(errno));
-                       return false;
-                }
-                else
-                {
-                       log(DEBUG,"Wrote %d chars to socket",n_sent);
-                        // advance the queue
-                        tb += n_sent;
-                        this->sendq = tb;
-                       return true;
-                }
+               if (n_sent != 0)
+               {
+                       if (n_sent == -1)
+                       {
+                               this->SetWriteError(strerror(errno));
+                               return false;
+                       }
+                       else
+                       {
+                               log(DEBUG,"Wrote %d chars to socket",n_sent);
+                               // advance the queue
+                                       tb += n_sent;
+                                       this->sendq = tb;
+                               return true;
+                       }
+               }
         }
        return true;
 }