arpadboda commented on a change in pull request #550: MINIFICPP-822 - Nanofi
raw S2S implementation shouldn't depend on any…
URL: https://github.com/apache/nifi-minifi-cpp/pull/550#discussion_r284309949
##########
File path: libminifi/src/io/DescriptorStream.cpp
##########
@@ -84,11 +84,10 @@ int DescriptorStream::readData(uint8_t *buf, int buflen) {
if (!IsNullOrEmpty(buf)) {
auto size_read = ::read(fd_, buf, buflen);
- if (size_read != buflen) {
+ if (size_read < 0) {
Review comment:
Testing doesn't work at all without it.
So UTF strings (which works) is a special way of communication as the length
of the string proceeds the string itself, you always know how many bytes to
read.
However in general case when you try to read all the data from the socket,
no matter how much is that, you fail.
The use case is creating a big buffer and read whatever we have in the
socket to it.
In this case I would expect the API to tell me how many bytes did it manage
to read. Instead it returned -1 in case it couldn't completely fill the buffer.
The only way to deal with this would had been reading bytes on by one, but
that still wouldn't work as the call after reading the last byte would end up
blocking...
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services