summaryrefslogtreecommitdiff
path: root/sleekxmpp/xmlstream
diff options
context:
space:
mode:
authorNathan Fritz <nathan@andyet.net>2010-10-20 19:18:27 -0700
committerNathan Fritz <nathan@andyet.net>2010-10-20 19:18:27 -0700
commit77eab6544f1f44f2450ecca4e7588dd60e484631 (patch)
tree1577381a1e45d75fe43ef16383f902395d1080f8 /sleekxmpp/xmlstream
parent11264fe0a8d1224b9a185fc0439359477ef9c3cc (diff)
downloadslixmpp-77eab6544f1f44f2450ecca4e7588dd60e484631.tar.gz
slixmpp-77eab6544f1f44f2450ecca4e7588dd60e484631.tar.bz2
slixmpp-77eab6544f1f44f2450ecca4e7588dd60e484631.tar.xz
slixmpp-77eab6544f1f44f2450ecca4e7588dd60e484631.zip
reconnect if session isn't established within 15 seconds
Diffstat (limited to 'sleekxmpp/xmlstream')
-rw-r--r--sleekxmpp/xmlstream/scheduler.py3
-rw-r--r--sleekxmpp/xmlstream/xmlstream.py7
2 files changed, 6 insertions, 4 deletions
diff --git a/sleekxmpp/xmlstream/scheduler.py b/sleekxmpp/xmlstream/scheduler.py
index b932b0a7..b1b81439 100644
--- a/sleekxmpp/xmlstream/scheduler.py
+++ b/sleekxmpp/xmlstream/scheduler.py
@@ -137,7 +137,7 @@ class Scheduler(object):
"""Process scheduled tasks."""
self.run = True
try:
- while self.run:
+ while self.run and (self.parentstop is None or not self.parentstop.isSet()):
wait = 1
updated = False
if self.schedule:
@@ -168,6 +168,7 @@ class Scheduler(object):
except KeyboardInterrupt:
self.run = False
if self.parentstop is not None:
+ logging.debug("stopping parent")
self.parentstop.set()
except SystemExit:
self.run = False
diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py
index 41ee8329..c8280c33 100644
--- a/sleekxmpp/xmlstream/xmlstream.py
+++ b/sleekxmpp/xmlstream/xmlstream.py
@@ -275,6 +275,7 @@ class XMLStream(object):
self.socket = ssl_socket
try:
+ logging.debug("Connecting to %s:%s" % self.address)
self.socket.connect(self.address)
self.set_socket(self.socket, ignore=True)
#this event is where you should set your application state
@@ -328,10 +329,10 @@ class XMLStream(object):
Reset the stream's state and reconnect to the server.
"""
logging.debug("reconnecting...")
- self.state.transition('connected', 'disconnected', wait=0.0,
+ self.state.transition('connected', 'disconnected', wait=2.0,
func=self._disconnect, args=(True,))
return self.state.transition('disconnected', 'connected',
- wait=0.0, func=self._connect)
+ wait=2.0, func=self._connect)
def set_socket(self, socket, ignore=False):
"""
@@ -669,7 +670,7 @@ class XMLStream(object):
# The body of this loop will only execute once per connection.
# Additional passes will be made only if an error occurs and
# reconnecting is permitted.
- while not self.stop.isSet() and firstrun or self.auto_reconnect:
+ while firstrun or (self.auto_reconnect and not self.stop.isSet()):
firstrun = False
try:
if self.is_client: