Skip to content

Commit f08e339

Browse files
authored
Merge pull request #74 from jfurcean/close_free_sockets
fix out of sockets issue
2 parents 421f755 + 9bd3af8 commit f08e339

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

adafruit_requests.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ def _free_sockets(self):
405405
self._close_socket(sock)
406406

407407
def _get_socket(self, host, port, proto, *, timeout=1):
408+
# pylint: disable=too-many-branches
408409
key = (host, port, proto)
409410
if key in self._open_sockets:
410411
sock = self._open_sockets[key]
@@ -434,6 +435,8 @@ def _get_socket(self, host, port, proto, *, timeout=1):
434435
)
435436
except OSError:
436437
continue
438+
except RuntimeError:
439+
continue
437440

438441
connect_host = addr_info[-1][0]
439442
if proto == "https:":

0 commit comments

Comments
 (0)