Don't retrieve cert until a connection is made.

This commit is contained in:
Lance Stout 2012-02-16 07:02:56 -08:00
parent 6d922d00c3
commit d807613117

View file

@ -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)