Browse Source

extmod/network_ninaw10: Return -1 on timeout from recv/send.

pull/8141/head
iabdalkader 3 years ago
committed by Damien George
parent
commit
73a6b53dbe
  1. 8
      extmod/network_ninaw10.c

8
extmod/network_ninaw10.c

@ -435,7 +435,7 @@ STATIC mp_uint_t network_ninaw10_socket_send(mod_network_socket_obj_t *socket, c
if (ret == NINA_ERROR_TIMEOUT) { if (ret == NINA_ERROR_TIMEOUT) {
// The socket is Not closed on timeout when calling functions that accept a timeout. // The socket is Not closed on timeout when calling functions that accept a timeout.
*_errno = MP_ETIMEDOUT; *_errno = MP_ETIMEDOUT;
return 0; return -1;
} else if (ret < 0) { } else if (ret < 0) {
// Close the socket on any other errors. // Close the socket on any other errors.
*_errno = ret; *_errno = ret;
@ -450,7 +450,7 @@ STATIC mp_uint_t network_ninaw10_socket_recv(mod_network_socket_obj_t *socket, b
if (ret == NINA_ERROR_TIMEOUT) { if (ret == NINA_ERROR_TIMEOUT) {
// The socket is Not closed on timeout when calling functions that accept a timeout. // The socket is Not closed on timeout when calling functions that accept a timeout.
*_errno = MP_ETIMEDOUT; *_errno = MP_ETIMEDOUT;
return 0; return -1;
} else if (ret < 0) { } else if (ret < 0) {
// Close the socket on any other errors. // Close the socket on any other errors.
*_errno = ret; *_errno = ret;
@ -482,7 +482,7 @@ STATIC mp_uint_t network_ninaw10_socket_sendto(mod_network_socket_obj_t *socket,
if (ret == NINA_ERROR_TIMEOUT) { if (ret == NINA_ERROR_TIMEOUT) {
// The socket is Not closed on timeout when calling functions that accept a timeout. // The socket is Not closed on timeout when calling functions that accept a timeout.
*_errno = MP_ETIMEDOUT; *_errno = MP_ETIMEDOUT;
return 0; return -1;
} else if (ret < 0) { } else if (ret < 0) {
*_errno = ret; *_errno = ret;
network_ninaw10_socket_close(socket); network_ninaw10_socket_close(socket);
@ -502,7 +502,7 @@ STATIC mp_uint_t network_ninaw10_socket_recvfrom(mod_network_socket_obj_t *socke
if (ret == NINA_ERROR_TIMEOUT) { if (ret == NINA_ERROR_TIMEOUT) {
// The socket is Not closed on timeout when calling functions that accept a timeout. // The socket is Not closed on timeout when calling functions that accept a timeout.
*_errno = MP_ETIMEDOUT; *_errno = MP_ETIMEDOUT;
return 0; return -1;
} else if (ret < 0) { } else if (ret < 0) {
// Close the socket on any other errors. // Close the socket on any other errors.
*_errno = ret; *_errno = ret;

Loading…
Cancel
Save