issue #406: ensure is_path_dead() socket is finalized.

issue260
David Wilson 6 years ago
parent 411af6c167
commit 661e274556

@ -49,10 +49,13 @@ from mitogen.core import LOG
def is_path_dead(path): def is_path_dead(path):
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
try: try:
s.connect(path) try:
except socket.error: s.connect(path)
e = sys.exc_info()[1] except socket.error:
return e.args[0] in (errno.ECONNREFUSED, errno.ENOENT) e = sys.exc_info()[1]
return e.args[0] in (errno.ECONNREFUSED, errno.ENOENT)
finally:
s.close()
return False return False

Loading…
Cancel
Save