From 49577e6c84ef717022884fdc13a13a584a66cf3c Mon Sep 17 00:00:00 2001 From: mathieui Date: Fri, 22 Jan 2021 22:04:41 +0100 Subject: [PATCH] Handle connection errors in start_tls (fix #3449) --- slixmpp/xmlstream/xmlstream.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/slixmpp/xmlstream/xmlstream.py b/slixmpp/xmlstream/xmlstream.py index dc2af77e..6b890729 100644 --- a/slixmpp/xmlstream/xmlstream.py +++ b/slixmpp/xmlstream/xmlstream.py @@ -622,6 +622,10 @@ class XMLStream(asyncio.BaseProtocol): else: self.event('ssl_invalid_chain', e) 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) pem_cert = ssl.DER_cert_to_PEM_cert(der_cert) self.event('ssl_cert', pem_cert)