Skip to content

Commit 1a3b276

Browse files
committed
Fix issue with pool interface
1 parent b60cba1 commit 1a3b276

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

adafruit_connection_manager.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
import errno
3030
import sys
3131

32+
WIZNET5K_SSL_SUPPORT_VERSION = (9, 1)
33+
3234
# typing
3335

3436

@@ -132,21 +134,15 @@ def get_radio_socketpool(radio):
132134
# versions of the Wiznet5k library or on boards withouut the ssl module
133135
# see https://docs.circuitpython.org/en/latest/shared-bindings/support_matrix.html
134136
ssl_context = None
135-
try_ssl = False
136137
cp_version = sys.implementation[1]
137-
if pool.SOCK_STREAM == 1 and cp_version[0] >= 9:
138-
if cp_version[0] > 9:
139-
try_ssl = True
140-
elif cp_version[0] == 9 and cp_version[1] >= 1:
141-
try_ssl = True
142-
143-
if try_ssl:
144-
try:
145-
import ssl # pylint: disable=import-outside-toplevel
146-
147-
ssl_context = ssl.create_default_context()
148-
except ImportError:
149-
"""SSL not on board default to fake_ssl_context"""
138+
if pool.SOCK_STREAM == 1 and cp_version >= WIZNET5K_SSL_SUPPORT_VERSION:
139+
try:
140+
import ssl # pylint: disable=import-outside-toplevel
141+
142+
ssl_context = ssl.create_default_context()
143+
pool.set_interface(radio)
144+
except ImportError:
145+
"""SSL not on board default to fake_ssl_context"""
150146

151147
if ssl_context is None:
152148
ssl_context = create_fake_ssl_context(pool, radio)

0 commit comments

Comments
 (0)