The unified diff between revisions [c0d2ea57..] and [e24ccc23..] is displayed below. It can also be downloaded as a raw diff.
This diff has been restricted to the following files: 'netsync.cc'
#
#
# patch "netsync.cc"
# from [e6da39e8b875004c1b0290a4fb274394d6bd1c6b]
# to [cba71cd069c2658e79568849fe0328c92695547d]
#
============================================================
--- netsync.cc e6da39e8b875004c1b0290a4fb274394d6bd1c6b
+++ netsync.cc cba71cd069c2658e79568849fe0328c92695547d
@@ -1313,7 +1313,11 @@ session::read_some()
{
I(inbuf.size() < constants::netcmd_maxsz);
char tmp[constants::bufsz];
- Netxx::signed_size_type count = str.read(tmp, sizeof(tmp));
+ size_t max_read = min(sizeof(tmp), cmd.get_max_read() - inbuf.size());
+ if (max_read == 0)
+ return true;
+
+ Netxx::signed_size_type count = str.read(tmp, max_read);
if (count > 0)
{
L(F("read %d bytes from fd %d (peer %s)\n") % count % fd % peer_id);