summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-05-24 17:26:22 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-05-24 17:26:22 +0000
commit688f218c733f9e750e53b4afd37b991648dfcd4f (patch)
tree7ef0072b71e57f560f21ef194d5e04507865f25c /src
parent9067d816e5797676004ae50babb262dc4ca702e1 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/connection.cpp29
1 files changed, 16 insertions, 13 deletions
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;
}