mirror of
				https://github.com/cuberite/polarssl.git
				synced 2025-11-03 20:22:59 -05: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
					
				@ -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…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user