lwip_sock: Make sock_tcp_read return data if available
When reading from the socket with `sock_tcp_read()` it would only return data from at most one internal connection buffer, even if the buffer passed to `sock_tcp_read()` is larger and there is more data available in the connection. This patch makes `sock_tcp_read` process all the available data so long as there's more data to read available immediately.
This commit is contained in:
parent
0397cab91c
commit
e469f2dea4
@ -353,7 +353,12 @@ ssize_t sock_tcp_read(sock_tcp_t *sock, void *data, size_t max_len,
|
|||||||
sock->last_buf = NULL;
|
sock->last_buf = NULL;
|
||||||
sock->last_offset = 0;
|
sock->last_offset = 0;
|
||||||
pbuf_free(buf);
|
pbuf_free(buf);
|
||||||
break;
|
/* Exit the loop only when there's no more data available in the
|
||||||
|
* connection. This allows to copy more data in a single read if
|
||||||
|
* available. */
|
||||||
|
if (!mbox_avail(&sock->base.conn->recvmbox.mbox)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (offset > 0) {
|
if (offset > 0) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user