Merge branch 'bugfix/mbedtls_non_blocking_sockets' into 'master'

mbedtls port: Fix detection of EWOULDBLOCK/EAGAIN with non-blocking sockets

Previous code read non-blocking status via fcntl first, which resets errno.

* Closes #424 https://github.com/espressif/esp-idf/pull/424
* Merges #425 https://github.com/espressif/esp-idf/pull/425

See merge request !575
pull/407/merge
Ivan Grokhotkov 2017-03-15 10:39:53 +08:00
commit 829800f272
1 zmienionych plików z 2 dodań i 2 usunięć

Wyświetl plik

@ -203,6 +203,8 @@ int mbedtls_net_bind( mbedtls_net_context *ctx, const char *bind_ip, const char
*/ */
static int net_would_block( const mbedtls_net_context *ctx ) static int net_would_block( const mbedtls_net_context *ctx )
{ {
int error = mbedtls_net_errno(ctx->fd);
/* /*
* Never return 'WOULD BLOCK' on a non-blocking socket * Never return 'WOULD BLOCK' on a non-blocking socket
*/ */
@ -210,8 +212,6 @@ static int net_would_block( const mbedtls_net_context *ctx )
return ( 0 ); return ( 0 );
} }
int error = mbedtls_net_errno(ctx->fd);
switch ( error ) { switch ( error ) {
#if defined EAGAIN #if defined EAGAIN
case EAGAIN: case EAGAIN: