From: brain Date: Tue, 24 May 2005 17:26:22 +0000 (+0000) Subject: Added code to not try and increment buffer if wrote 0 chars X-Git-Tag: v2.0.23~10189 X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=688f218c733f9e750e53b4afd37b991648dfcd4f;p=user%2Fhenk%2Fcode%2Finspircd.git Added code to not try and increment buffer if wrote 0 chars git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1500 e03df62e-2008-0410-955e-edbf42e46eb7 --- diff --git a/src/connection.cpp b/src/connection.cpp index 30a961e96..ce5ff3f9f 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -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; }