summaryrefslogtreecommitdiff
path: root/sleekxmpp/xmlstream
diff options
context:
space:
mode:
authorBrian Beggs <macdiesel@gmail.com>2010-06-18 09:51:29 -0400
committerBrian Beggs <macdiesel@gmail.com>2010-06-18 09:51:29 -0400
commitf5d04664627b28f9439d9ed5214a0060a77a2bf2 (patch)
treeab388727954cef17fd80158f32fc6cf0d4079290 /sleekxmpp/xmlstream
parentf659e3081e09c88c25bebee3b08c767575b68dd4 (diff)
downloadslixmpp-f5d04664627b28f9439d9ed5214a0060a77a2bf2.tar.gz
slixmpp-f5d04664627b28f9439d9ed5214a0060a77a2bf2.tar.bz2
slixmpp-f5d04664627b28f9439d9ed5214a0060a77a2bf2.tar.xz
slixmpp-f5d04664627b28f9439d9ed5214a0060a77a2bf2.zip
working on digest-md5 authentication
Diffstat (limited to 'sleekxmpp/xmlstream')
-rw-r--r--sleekxmpp/xmlstream/xmlstream.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py
index 6dbe7b30..a8bcac00 100644
--- a/sleekxmpp/xmlstream/xmlstream.py
+++ b/sleekxmpp/xmlstream/xmlstream.py
@@ -82,7 +82,7 @@ class XMLStream(object):
self.stream_footer = "</stream>"
self.eventqueue = queue.Queue()
- self.sendqueue = queue.Queue()
+ self.sendqueue = queue.PriorityQueue()
self.scheduler = scheduler.Scheduler(self.eventqueue)
self.namespace_map = {}
@@ -219,7 +219,7 @@ class XMLStream(object):
while self.run:
if not self.state.ensure('connected',wait=2): continue
try:
- self.sendRaw(self.stream_header)
+ self.sendPriorityRaw(self.stream_header)
while self.run and self.__readXML(): pass
except socket.timeout:
logging.debug('socket rcv timeout')
@@ -277,7 +277,7 @@ class XMLStream(object):
data = None
try:
- data = self.sendqueue.get(True,5)
+ data = self.sendqueue.get(True,5)[1]
logging.debug("SEND: %s" % data)
self.socket.sendall(data.encode('utf-8'))
except queue.Empty:
@@ -298,7 +298,11 @@ class XMLStream(object):
self.disconnect(reconnect=True)
def sendRaw(self, data):
- self.sendqueue.put(data)
+ self.sendqueue.put((1, data))
+ return True
+
+ def sendPriorityRaw(self, data):
+ self.sendqueue.put((0, data))
return True
def disconnect(self, reconnect=False):
@@ -306,7 +310,7 @@ class XMLStream(object):
logging.warning("Already disconnected.")
return
logging.debug("Disconnecting...")
- self.sendRaw(self.stream_footer)
+ self.sendPriorityRaw(self.stream_footer)
time.sleep(5)
#send end of stream
#wait for end of stream back