/* If QoS was applied, return the data that was pending. */
if (sock->qos->applied && sock->qos->data_len) {
memcpy(buf, qosbuf, sock->qos->data_len);
+ len = sock->qos->data_len;
sock->qos->data_len = 0;
- return sock->qos->data_len;
+ return len;
}
/* If we have active QoS data pending, return with no data */
return -1;
}
- /* Read the data from the socket. Never read more than the max limit. */
+ /* Read the data from the socket. The qosbuf size is always the max
+ read limit size. */
len = (buf_len < sock->qos->read_limit_bytes ? buf_len :
sock->qos->read_limit_bytes);
len = read(sock->sock, qosbuf, len);