diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py index 321e2694..3baa5b80 100644 --- a/sleekxmpp/xmlstream/xmlstream.py +++ b/sleekxmpp/xmlstream/xmlstream.py @@ -537,8 +537,8 @@ class XMLStream(object): try: cert.verify(self._expected_server_name, self._der_cert) except cert.CertificateError as err: - log.error(err.message) if not self.event_handled('ssl_invalid_cert'): + log.error(err.message) self.disconnect(send_close=False) else: self.event('ssl_invalid_cert', @@ -828,8 +828,8 @@ class XMLStream(object): try: cert.verify(self._expected_server_name, self._der_cert) except cert.CertificateError as err: - log.error(err.message) if not self.event_handled('ssl_invalid_cert'): + log.error(err.message) self.disconnect(self.auto_reconnect, send_close=False) else: self.event('ssl_invalid_cert', pem_cert, direct=True)