nb: read to the end of the full buffer

Change-Id: I94264f748ac974f636ab6d21a5ccbb77532136f6
This commit is contained in:
Ashod Nakashian 2017-02-20 23:28:20 -05:00 committed by Jan Holesovsky
parent c37079fcee
commit ab82db72ee

View file

@ -339,19 +339,18 @@ public:
// TODO: Cap the buffer size, lest we grow beyond control.
do
{
len = readData(buf, sizeof(buf) - 1);
len = readData(buf, sizeof(buf));
}
while (len < 0 && errno == EINTR);
if (len > 0)
{
assert (len < ssize_t(sizeof(buf)));
assert (len <= ssize_t(sizeof(buf)));
_inBuffer.insert(_inBuffer.end(), &buf[0], &buf[len]);
continue;
}
// else poll will handle errors.
}
while (len == (sizeof(buf) - 1));
while (len == (sizeof(buf)));
return len != 0; // zero is eof / clean socket close.
}