summaryrefslogtreecommitdiff
path: root/sleekxmpp/xmlstream
diff options
context:
space:
mode:
authorMike Taylor <bear42@gmail.com>2015-04-11 20:12:19 -0400
committerMike Taylor <bear42@gmail.com>2015-04-11 20:12:19 -0400
commit86e85f98357b40941fddb7a2dbf8fbe16f96032e (patch)
tree65a86c0378c5e59f1822dfba8ed484f77ff5ebeb /sleekxmpp/xmlstream
parentcc145d20b077442b7d4118d4d2f4c27e1b0faf0c (diff)
parent073e85381a86069e931369bb5353cab2a2e3682d (diff)
downloadslixmpp-86e85f98357b40941fddb7a2dbf8fbe16f96032e.tar.gz
slixmpp-86e85f98357b40941fddb7a2dbf8fbe16f96032e.tar.bz2
slixmpp-86e85f98357b40941fddb7a2dbf8fbe16f96032e.tar.xz
slixmpp-86e85f98357b40941fddb7a2dbf8fbe16f96032e.zip
Merge pull request #313 from mayflower/develop
Proposing #310 again in fixed version
Diffstat (limited to 'sleekxmpp/xmlstream')
-rw-r--r--sleekxmpp/xmlstream/xmlstream.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py
index 0d602b52..f9ec4947 100644
--- a/sleekxmpp/xmlstream/xmlstream.py
+++ b/sleekxmpp/xmlstream/xmlstream.py
@@ -857,7 +857,7 @@ class XMLStream(object):
if sys.version_info >= (2, 7):
ssl_args['ciphers'] = self.ciphers
- ssl_socket = ssl.wrap_socket(self.socket, **ssl_args);
+ ssl_socket = ssl.wrap_socket(self.socket, **ssl_args)
if hasattr(self.socket, 'socket'):
# We are using a testing socket, so preserve the top
@@ -1153,7 +1153,7 @@ class XMLStream(object):
"""
return len(self.__event_handlers.get(name, []))
- def event(self, name, data={}, direct=False):
+ def event(self, name, data=None, direct=False):
"""Manually trigger a custom event.
:param name: The name of the event to trigger.
@@ -1164,6 +1164,9 @@ class XMLStream(object):
event queue. All event handlers will run in the
same thread.
"""
+ if not data:
+ data = {}
+
log.debug("Event triggered: " + name)
handlers = self.__event_handlers.get(name, [])
@@ -1323,9 +1326,6 @@ class XMLStream(object):
try:
sent += self.socket.send(data[sent:])
count += 1
- except Socket.error as serr:
- if serr.errno != errno.EINTR:
- raise
except ssl.SSLError as serr:
if tries >= self.ssl_retry_max:
log.debug('SSL error: max retries reached')
@@ -1340,6 +1340,9 @@ class XMLStream(object):
if not self.stop.is_set():
time.sleep(self.ssl_retry_delay)
tries += 1
+ except Socket.error as serr:
+ if serr.errno != errno.EINTR:
+ raise
if count > 1:
log.debug('SENT: %d chunks', count)
except (Socket.error, ssl.SSLError) as serr:
@@ -1749,9 +1752,6 @@ class XMLStream(object):
try:
sent += self.socket.send(enc_data[sent:])
count += 1
- except Socket.error as serr:
- if serr.errno != errno.EINTR:
- raise
except ssl.SSLError as serr:
if tries >= self.ssl_retry_max:
log.debug('SSL error: max retries reached')
@@ -1764,6 +1764,9 @@ class XMLStream(object):
if not self.stop.is_set():
time.sleep(self.ssl_retry_delay)
tries += 1
+ except Socket.error as serr:
+ if serr.errno != errno.EINTR:
+ raise
if count > 1:
log.debug('SENT: %d chunks', count)
self.send_queue.task_done()