summaryrefslogtreecommitdiff
path: root/sleekxmpp/xmlstream
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2014-08-18 13:34:15 -0700
committerLance Stout <lancestout@gmail.com>2014-08-18 13:34:15 -0700
commite5e2fbb16b4d9c11fc676925c6a13943282a3c66 (patch)
tree5dc018384ad03253608ff79c9fdbb577b84d2d2f /sleekxmpp/xmlstream
parenta20582aba4de85f5a193395df2d0ed8c75220bfb (diff)
parent3dd379cdf12d885e26f8ec26c54879a95d5f0b84 (diff)
downloadslixmpp-e5e2fbb16b4d9c11fc676925c6a13943282a3c66.tar.gz
slixmpp-e5e2fbb16b4d9c11fc676925c6a13943282a3c66.tar.bz2
slixmpp-e5e2fbb16b4d9c11fc676925c6a13943282a3c66.tar.xz
slixmpp-e5e2fbb16b4d9c11fc676925c6a13943282a3c66.zip
Merge pull request #311 from Mayflower/develop
Revert "cleanup semicolons, whitespace and mutable default arguments"
Diffstat (limited to 'sleekxmpp/xmlstream')
-rw-r--r--sleekxmpp/xmlstream/xmlstream.py19
1 files changed, 8 insertions, 11 deletions
diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py
index 01787b5e..e011cf3d 100644
--- a/sleekxmpp/xmlstream/xmlstream.py
+++ b/sleekxmpp/xmlstream/xmlstream.py
@@ -853,7 +853,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
@@ -1149,7 +1149,7 @@ class XMLStream(object):
"""
return len(self.__event_handlers.get(name, []))
- def event(self, name, data=None, direct=False):
+ def event(self, name, data={}, direct=False):
"""Manually trigger a custom event.
:param name: The name of the event to trigger.
@@ -1160,9 +1160,6 @@ 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, [])
@@ -1322,6 +1319,9 @@ 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')
@@ -1336,9 +1336,6 @@ 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:
@@ -1748,6 +1745,9 @@ 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')
@@ -1760,9 +1760,6 @@ 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()