mirror of
https://github.com/zeromq/libzmq.git
synced 2025-01-14 17:58:01 +08:00
Comments improvement
related to fairness while reading/writing large messages Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
This commit is contained in:
parent
17fdb5e3a8
commit
d36d9a378a
@ -110,6 +110,9 @@ void zmq::zmq_engine_t::in_event ()
|
|||||||
if (!insize) {
|
if (!insize) {
|
||||||
|
|
||||||
// Retrieve the buffer and read as much data as possible.
|
// 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);
|
decoder.get_buffer (&inpos, &insize);
|
||||||
insize = tcp_socket.read (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
|
// 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);
|
int nbytes = tcp_socket.write (outpos, outsize);
|
||||||
|
|
||||||
// Handle problems with the connection.
|
// Handle problems with the connection.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user