Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

Fixes an SSL / TLS socket blocking problem #80

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion esp32/mods/modwlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1373,8 +1373,16 @@ static int wlan_socket_recv(mod_network_socket_obj_t *s, byte *buf, mp_uint_t le
mp_obj_ssl_socket_t *ss = (mp_obj_ssl_socket_t *)s;
do {
ret = mbedtls_ssl_read(&ss->ssl, (unsigned char *)buf, len);
if (ret == MBEDTLS_ERR_SSL_WANT_READ || ret == MBEDTLS_ERR_SSL_WANT_WRITE || ret == MBEDTLS_ERR_SSL_TIMEOUT) {
if (ret == MBEDTLS_ERR_SSL_WANT_READ || ret == MBEDTLS_ERR_SSL_WANT_WRITE) {
// do nothing
} else if(ret == MBEDTLS_ERR_SSL_TIMEOUT){
// printf("SSL timeout recieved\n");
// non-blocking return
if(s->sock_base.timeout == 0){
ret = 0;
break;
}
// blocking do nothing
} else if (ret == MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY) {
// printf("Close notify received\n");
ret = 0;
Expand Down