From d80761311720263521a115ce4fc5c377e0b296d1 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Thu, 16 Feb 2012 07:02:56 -0800 Subject: Don't retrieve cert until a connection is made. --- sleekxmpp/xmlstream/xmlstream.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'sleekxmpp') diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py index 9799c299..d5a7e827 100644 --- a/sleekxmpp/xmlstream/xmlstream.py +++ b/sleekxmpp/xmlstream/xmlstream.py @@ -461,14 +461,16 @@ class XMLStream(object): else: self.socket = ssl_socket - cert = self.socket.getpeercert() - log.debug('CERT: %s', cert) - self.event('ssl_cert', cert, direct=True) try: if not self.use_proxy: log.debug("Connecting to %s:%s", *self.address) self.socket.connect(self.address) + if self.use_ssl and self.ssl_support: + cert = self.socket.getpeercert() + log.debug('CERT: %s', cert) + self.event('ssl_cert', cert, direct=True) + self.set_socket(self.socket, ignore=True) #this event is where you should set your application state self.event("connected", direct=True) -- cgit v1.2.3