diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-02-07 18:45:00 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-02-07 18:45:00 +0000 |
commit | 7d5e82ead27f83364e1f018bf9626ac125d6642b (patch) | |
tree | 39f3b5513d552ac09c6d035e1f945152a2a98b2d /src | |
parent | 6faa21240d360000d02ff1943b04d2ac9e15df95 (diff) |
Uses less write() calls
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3129 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/socket.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/socket.cpp b/src/socket.cpp index 15a076273..550783aed 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -236,7 +236,6 @@ char* InspSocket::Read() int InspSocket::Write(std::string data) { this->Buffer.append(data); - this->FlushWriteBuffer(); return data.length(); } @@ -277,14 +276,14 @@ bool InspSocket::Timeout(time_t current) this->state = I_ERROR; return true; } - if (this->Buffer.length()) - this->FlushWriteBuffer(); + this->FlushWriteBuffer(); return false; } bool InspSocket::Poll() { int incoming = -1; + bool n = true; switch (this->state) { @@ -310,15 +309,15 @@ bool InspSocket::Poll() return true; break; case I_CONNECTED: - return this->OnDataReady(); + n = this->OnDataReady(); + /* Flush any pending, but not till after theyre done with the event + * so there are less write calls involved. */ + this->FlushWriteBuffer(); + return n; break; default: break; } - - if (this->Buffer.length()) - this->FlushWriteBuffer(); - return true; } |