If params.size is non-zero limit size of the read to either the buffer
free space or params.size, whichever is smallest.
{
/* Attempt a read */
++ statCounter.syscalls.sock.reads;
- const SBuf::size_type sz = buf.spaceSize();
+ SBuf::size_type sz = buf.spaceSize();
+ if (params.size > 0 && params.size < sz)
+ sz = params.size;
char *inbuf = buf.rawSpace(sz);
errno = 0;
const int retval = FD_READ_METHOD(params.conn->fd, inbuf, sz);
/**
* Perform a read(2) on a connection immediately.
*
+ * If params.size is non-zero will limit size of the read to either
+ * the buffer free space or params.size, whichever is smallest.
+ *
* The returned flag is also placed in params.flag.
*
* \retval Comm::OK data has been read and placed in buf, amount in params.size