summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2011-03-27 19:41:32 +0200
committerMartin Sustrik <sustrik@250bpm.com>2011-03-27 19:41:32 +0200
commitd36d9a378a9f3c561f2ae7849cee907c59d33b72 (patch)
treeb5f8a03df511720992be761557265499f302b7ae /src
parent17fdb5e3a8956887e76c487e36d1dc8b667ca248 (diff)
Comments improvement
related to fairness while reading/writing large messages Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src')
-rw-r--r--src/zmq_engine.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/zmq_engine.cpp b/src/zmq_engine.cpp
index da9d18c..725ba96 100644
--- a/src/zmq_engine.cpp
+++ b/src/zmq_engine.cpp
@@ -110,6 +110,9 @@ void zmq::zmq_engine_t::in_event ()
if (!insize) {
// Retrieve the buffer and read as much data as possible.
+ // Note that buffer can be arbitrarily large. However, we assume
+ // the underlying TCP layer has fixed buffer size and thus the
+ // number of bytes read will be always limited.
decoder.get_buffer (&inpos, &insize);
insize = tcp_socket.read (inpos, insize);
@@ -179,7 +182,10 @@ void zmq::zmq_engine_t::out_event ()
}
// If there are any data to write in write buffer, write as much as
- // possible to the socket.
+ // possible to the socket. Note that amount of data to write can be
+ // arbitratily large. However, we assume that underlying TCP layer has
+ // limited transmission buffer and thus the actual number of bytes
+ // written should be reasonably modest.
int nbytes = tcp_socket.write (outpos, outsize);
// Handle problems with the connection.