mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-08-08 00:23:39 +08:00
Fix broken MSG_PEEK on TCP sockets (post-2.0.3 bug)
MSG_PEEK on TCP sockets was broken since commit b71d4477ea
from 06.03.2017: recv hung in an endless loop and tcp_recved() was called for peeked data
(which would result in a too large window advertised).
Aded TCP MSG_PEEK to socket unit tests
This commit is contained in:
@@ -926,9 +926,9 @@ lwip_recv_tcp(struct lwip_sock *sock, void *mem, size_t len, int flags)
|
||||
/* once we have some data to return, only add more if we don't need to wait */
|
||||
apiflags |= NETCONN_DONTBLOCK;
|
||||
/* @todo: do we need to support peeking more than one pbuf? */
|
||||
} while ((recv_left > 0) || (flags & MSG_PEEK));
|
||||
} while ((recv_left > 0) && !(flags & MSG_PEEK));
|
||||
lwip_recv_tcp_done:
|
||||
if (recvd > 0) {
|
||||
if ((recvd > 0) && !(flags & MSG_PEEK)) {
|
||||
/* ensure window update after copying all data */
|
||||
netconn_tcp_recvd(sock->conn, (size_t)recvd);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user