summaryrefslogtreecommitdiff
path: root/sleekxmpp/plugins/xep_0198
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-06-19 21:50:33 -0700
committerLance Stout <lancestout@gmail.com>2012-06-19 21:50:33 -0700
commit5820d49cd401a1362a8a675c4b91935adb1240fe (patch)
treef40f78839ae3004bfb0b8da1ae93d61759d8ad66 /sleekxmpp/plugins/xep_0198
parent1ab66e576786ecb0cfb9b6b163811735564b951b (diff)
parent36c11ad9de7c1b5a199aa5a4302e33085513c126 (diff)
downloadslixmpp-5820d49cd401a1362a8a675c4b91935adb1240fe.tar.gz
slixmpp-5820d49cd401a1362a8a675c4b91935adb1240fe.tar.bz2
slixmpp-5820d49cd401a1362a8a675c4b91935adb1240fe.tar.xz
slixmpp-5820d49cd401a1362a8a675c4b91935adb1240fe.zip
Merge branch 'master' into develop
Conflicts: sleekxmpp/basexmpp.py
Diffstat (limited to 'sleekxmpp/plugins/xep_0198')
-rw-r--r--sleekxmpp/plugins/xep_0198/stanza.py5
-rw-r--r--sleekxmpp/plugins/xep_0198/stream_management.py14
2 files changed, 9 insertions, 10 deletions
diff --git a/sleekxmpp/plugins/xep_0198/stanza.py b/sleekxmpp/plugins/xep_0198/stanza.py
index 5cf93436..6461d766 100644
--- a/sleekxmpp/plugins/xep_0198/stanza.py
+++ b/sleekxmpp/plugins/xep_0198/stanza.py
@@ -82,7 +82,6 @@ class Resumed(StanzaBase):
self._set_attr('h', str(val))
-
class Failed(StanzaBase, Error):
name = 'failed'
namespace = 'urn:xmpp:sm:3'
@@ -106,7 +105,7 @@ class StreamManagement(ElementBase):
self.del_required()
if val:
self._set_sub_text('required', '', keep=True)
-
+
def del_required(self):
self._del_sub('required')
@@ -117,7 +116,7 @@ class StreamManagement(ElementBase):
self.del_optional()
if val:
self._set_sub_text('optional', '', keep=True)
-
+
def del_optional(self):
self._del_sub('optional')
diff --git a/sleekxmpp/plugins/xep_0198/stream_management.py b/sleekxmpp/plugins/xep_0198/stream_management.py
index 7045ad21..05d5856f 100644
--- a/sleekxmpp/plugins/xep_0198/stream_management.py
+++ b/sleekxmpp/plugins/xep_0198/stream_management.py
@@ -21,7 +21,7 @@ from sleekxmpp.plugins.xep_0198 import stanza
log = logging.getLogger(__name__)
-MAX_SEQ = 2**32
+MAX_SEQ = 2 ** 32
class XEP_0198(BasePlugin):
@@ -69,7 +69,7 @@ class XEP_0198(BasePlugin):
self.enabled = threading.Event()
self.unacked_queue = collections.deque()
-
+
self.seq_lock = threading.Lock()
self.handled_lock = threading.Lock()
self.ack_lock = threading.Lock()
@@ -197,7 +197,7 @@ class XEP_0198(BasePlugin):
def _handle_enabled(self, stanza):
"""Save the SM-ID, if provided.
-
+
Raises an :term:`sm_enabled` event.
"""
self.xmpp.features.add('stream_management')
@@ -231,7 +231,7 @@ class XEP_0198(BasePlugin):
def _handle_ack(self, ack):
"""Process a server ack by freeing acked stanzas from the queue.
-
+
Raises a :term:`stanza_acked` event for each acked stanza.
"""
if ack['h'] == self.last_ack:
@@ -243,10 +243,10 @@ class XEP_0198(BasePlugin):
log.debug("Ack: %s, Last Ack: %s, " + \
"Unacked: %s, Num Acked: %s, " + \
"Remaining: %s",
- ack['h'],
- self.last_ack,
+ ack['h'],
+ self.last_ack,
num_unacked,
- num_acked,
+ num_acked,
num_unacked - num_acked)
for x in range(num_acked):
seq, stanza = self.unacked_queue.popleft()