Commit 73a6b53d authored by iabdalkader's avatar iabdalkader Committed by Damien George

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

parent 544c232e
...@@ -435,7 +435,7 @@ STATIC mp_uint_t network_ninaw10_socket_send(mod_network_socket_obj_t *socket, 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 ...@@ -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, ...@@ -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 ...@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment