fix crash triggered by port scans closing socket

This commit is contained in:
Mark Heiges
2020-05-09 15:21:30 -04:00
committed by Brian May
parent 535eb62928
commit 534ad8dfed
2 changed files with 13 additions and 2 deletions

View File

@ -96,7 +96,10 @@ def _try_peername(sock):
return '%s:%s' % (pn[0], pn[1])
except socket.error:
_, e = sys.exc_info()[:2]
if e.args[0] not in (errno.ENOTCONN, errno.ENOTSOCK):
if e.args[0] == errno.EINVAL:
debug2("_try_peername error: sock.getpeername() %s\nsocket is probably closed.\n" % e)
pass
elif e.args[0] not in (errno.ENOTCONN, errno.ENOTSOCK):
raise
except AttributeError:
pass