extmod/modssl_mbedtls: Reference SSLContext from SSLSocket.

Prevent the GC cleaning up (and finalising) the SSLContext while the
socket is still live.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This commit is contained in:
Jim Mussared 2023-08-01 15:12:14 +10:00
parent 01c758e26a
commit 70c564324c
1 changed files with 1 additions and 0 deletions

View File

@ -357,6 +357,7 @@ STATIC mp_obj_t ssl_socket_make_new(mp_obj_ssl_context_t *ssl_context, mp_obj_t
mp_obj_ssl_socket_t *o = m_new_obj(mp_obj_ssl_socket_t);
#endif
o->base.type = &ssl_socket_type;
o->ssl_context = ssl_context;
o->sock = sock;
o->poll_mask = 0;
o->last_error = 0;