mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-19 16:03:00 +00:00
close socket when testing connections
rather than relying on garbage collection
This commit is contained in:
@@ -40,7 +40,7 @@ def can_connect(ip, port):
|
||||
if ip in {'', '0.0.0.0'}:
|
||||
ip = '127.0.0.1'
|
||||
try:
|
||||
socket.create_connection((ip, port))
|
||||
socket.create_connection((ip, port)).close()
|
||||
except socket.error as e:
|
||||
if e.errno not in {errno.ECONNREFUSED, errno.ETIMEDOUT}:
|
||||
app_log.error("Unexpected error connecting to %s:%i %s", ip, port, e)
|
||||
|
Reference in New Issue
Block a user