1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

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:
iosabi 2021-04-10 18:45:57 +02:00
parent 0397cab91c
commit e469f2dea4

View File

@ -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_offset = 0;
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) {