mirror of
https://github.com/yuzu-emu/mbedtls
synced 2024-11-25 16:45:29 +00:00
Fix net_accept() for UDP sockets on Windows
On Windows, recvfrom() returns an error code if the destination buffer is too small to hold the next datagram.
This commit is contained in:
parent
a16e7c468c
commit
16a17a496c
1 changed files with 9 additions and 0 deletions
|
@ -309,6 +309,15 @@ int mbedtls_net_accept( int bind_fd, int *client_fd,
|
|||
|
||||
ret = recvfrom( bind_fd, buf, sizeof( buf ), MSG_PEEK,
|
||||
(struct sockaddr *) &client_addr, &n );
|
||||
|
||||
#if defined(_WIN32)
|
||||
if( ret == SOCKET_ERROR &&
|
||||
WSAGetLastError() == WSAEMSGSIZE )
|
||||
{
|
||||
/* We know buf is too small, thanks, just peeking here */
|
||||
ret = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if( ret < 0 )
|
||||
|
|
Loading…
Reference in a new issue