summaryrefslogtreecommitdiff
path: root/sleekxmpp/xmlstream
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-08-19 10:11:17 -0700
committerLance Stout <lancestout@gmail.com>2012-08-19 10:11:17 -0700
commit7d382a2bfdd417e5984201a597e2f55a61e95fde (patch)
tree9a1123010fc4fc65d648582ddf30da3d5079fe1f /sleekxmpp/xmlstream
parentff28b0a005410a2604b7b889e0347ae9d6a7efd9 (diff)
parent09bec1c4fef78f9df021099d9b79d4f92c2af895 (diff)
downloadslixmpp-7d382a2bfdd417e5984201a597e2f55a61e95fde.tar.gz
slixmpp-7d382a2bfdd417e5984201a597e2f55a61e95fde.tar.bz2
slixmpp-7d382a2bfdd417e5984201a597e2f55a61e95fde.tar.xz
slixmpp-7d382a2bfdd417e5984201a597e2f55a61e95fde.zip
Merge pull request #195 from FlorianFieber/develop
Fix certificate expiration scheduler
Diffstat (limited to 'sleekxmpp/xmlstream')
-rw-r--r--sleekxmpp/xmlstream/xmlstream.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py
index df06d067..246bc205 100644
--- a/sleekxmpp/xmlstream/xmlstream.py
+++ b/sleekxmpp/xmlstream/xmlstream.py
@@ -901,9 +901,15 @@ class XMLStream(object):
log.warn('CERT: Certificate has expired.')
restart()
+ try:
+ total_seconds = cert_ttl.total_seconds()
+ except AttributeError:
+ # for Python < 2.7
+ total_seconds = (cert_ttl.microseconds + (cert_ttl.seconds + cert_ttl.days * 24 * 3600) * 10**6) / 10**6
+
log.info('CERT: Time until certificate expiration: %s' % cert_ttl)
self.schedule('Certificate Expiration',
- cert_ttl.seconds,
+ total_seconds,
restart)
def _start_keepalive(self, event):