summaryrefslogtreecommitdiff
path: root/sleekxmpp/xmlstream/filesocket.py
diff options
context:
space:
mode:
Diffstat (limited to 'sleekxmpp/xmlstream/filesocket.py')
-rw-r--r--sleekxmpp/xmlstream/filesocket.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/sleekxmpp/xmlstream/filesocket.py b/sleekxmpp/xmlstream/filesocket.py
index 56554c73..53b83bc7 100644
--- a/sleekxmpp/xmlstream/filesocket.py
+++ b/sleekxmpp/xmlstream/filesocket.py
@@ -13,6 +13,7 @@
"""
from socket import _fileobject
+import errno
import socket
@@ -29,12 +30,18 @@ class FileSocket(_fileobject):
"""Read data from the socket as if it were a file."""
if self._sock is None:
return None
- data = self._sock.recv(size)
+ while True:
+ try:
+ data = self._sock.recv(size)
+ break
+ except socket.error as serr:
+ if serr.errno != errno.EINTR:
+ raise
if data is not None:
return data
-class Socket26(socket._socketobject):
+class Socket26(socket.socket):
"""A custom socket implementation that uses our own FileSocket class
to work around issues in Python 2.6 when using sockets as files.