Handle connection errors in start_tls (fix #3449)

This commit is contained in:
mathieui 2021-01-22 22:04:41 +01:00
parent b784b68bcd
commit 49577e6c84

View file

@ -622,6 +622,10 @@ class XMLStream(asyncio.BaseProtocol):
else: else:
self.event('ssl_invalid_chain', e) self.event('ssl_invalid_chain', e)
return False return False
except OSError as exc:
log.debug("Connection error:", exc_info=True)
self.disconnect()
return False
der_cert = transp.get_extra_info("ssl_object").getpeercert(True) der_cert = transp.get_extra_info("ssl_object").getpeercert(True)
pem_cert = ssl.DER_cert_to_PEM_cert(der_cert) pem_cert = ssl.DER_cert_to_PEM_cert(der_cert)
self.event('ssl_cert', pem_cert) self.event('ssl_cert', pem_cert)