Skip to content

Commit 1641a7c

Browse files
committed
Pico W: ssl: Correctly handle errors in send/recv
The prefixed versions raise Python exceptions, the un-prefixed return negative error values. We don't want to raise an exception from here, it leaves the SSL stack in an undefined state.
1 parent 7c849fd commit 1641a7c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ports/raspberrypi/common-hal/ssl/SSLSocket.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ STATIC int _mbedtls_ssl_send(void *ctx, const byte *buf, size_t len) {
100100
mp_obj_t sock = *(mp_obj_t *)ctx;
101101

102102
// mp_uint_t out_sz = sock_stream->write(sock, buf, len, &err);
103-
mp_int_t out_sz = common_hal_socketpool_socket_send(sock, buf, len);
103+
mp_int_t out_sz = socketpool_socket_send(sock, buf, len);
104104
DEBUG("socket_send() -> %d", out_sz);
105105
if (out_sz < 0) {
106106
int err = -out_sz;
@@ -118,7 +118,7 @@ STATIC int _mbedtls_ssl_send(void *ctx, const byte *buf, size_t len) {
118118
STATIC int _mbedtls_ssl_recv(void *ctx, byte *buf, size_t len) {
119119
mp_obj_t sock = *(mp_obj_t *)ctx;
120120

121-
mp_int_t out_sz = common_hal_socketpool_socket_recv_into(sock, buf, len);
121+
mp_int_t out_sz = socketpool_socket_recv_into(sock, buf, len);
122122
DEBUG("socket_recv() -> %d", out_sz);
123123
if (out_sz < 0) {
124124
int err = -out_sz;

0 commit comments

Comments
 (0)