1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-29 11:41:15 +03:00

Fix missing return statement ssl_server2 idling

Also, introduce MBEDTLS_EINTR locally in net_sockets.c
for the platform-dependent return code macro used by
the `select` call to indicate that the poll was interrupted
by a signal handler: On Unix, the corresponding macro is EINTR,
while on Windows, it's WSAEINTR.
This commit is contained in:
Hanno Becker
2018-03-15 15:49:24 +00:00
parent 80e06d77d9
commit ef52796537
3 changed files with 7 additions and 8 deletions

View File

@ -45,6 +45,8 @@
#if (defined(_WIN32) || defined(_WIN32_WCE)) && !defined(EFIX64) && \
!defined(EFI32)
#define MBEDTLS_EINTR WSAEINTR
#ifdef _WIN32_WINNT
#undef _WIN32_WINNT
#endif
@ -82,6 +84,8 @@ static int wsa_init_done = 0;
#include <netdb.h>
#include <errno.h>
#define MBEDTLS_EINTR EINTR
#endif /* ( _WIN32 || _WIN32_WCE ) && !EFIX64 && !EFI32 */
/* Some MS functions want int and MSVC warns if we pass size_t,
@ -475,12 +479,7 @@ int mbedtls_net_poll( mbedtls_net_context *ctx, uint32_t rw, uint32_t timeout )
ret = select( fd + 1, &read_fds, &write_fds, NULL,
timeout == (uint32_t) -1 ? NULL : &tv );
}
#if ( defined(_WIN32) || defined(_WIN32_WCE) ) && !defined(EFIX64) && \
!defined(EFI32)
while( ret == WSAEINTR );
#else
while( ret == EINTR );
#endif
while( ret == MBEDTLS_EINTR );
if( ret < 0 )
return( MBEDTLS_ERR_NET_POLL_FAILED );