diff options
author | Anton Ryzhov <anton@ryzhov.me> | 2013-06-20 15:30:51 +0400 |
---|---|---|
committer | Anton Ryzhov <anton@ryzhov.me> | 2013-06-20 18:29:53 +0400 |
commit | 1776e2edccf5f26d1d869791e19442ea35876bb1 (patch) | |
tree | 1e3d06b33822a46f1db44a9107ab3e8df08da8c2 /sleekxmpp/xmlstream/filesocket.py | |
parent | baf9aaf26c80c87e770cdf35b1fa4fe231663246 (diff) | |
download | slixmpp-1776e2edccf5f26d1d869791e19442ea35876bb1.tar.gz slixmpp-1776e2edccf5f26d1d869791e19442ea35876bb1.tar.bz2 slixmpp-1776e2edccf5f26d1d869791e19442ea35876bb1.tar.xz slixmpp-1776e2edccf5f26d1d869791e19442ea35876bb1.zip |
Skip EINTR errors on raw sockets
Diffstat (limited to 'sleekxmpp/xmlstream/filesocket.py')
-rw-r--r-- | sleekxmpp/xmlstream/filesocket.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sleekxmpp/xmlstream/filesocket.py b/sleekxmpp/xmlstream/filesocket.py index d4537998..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,7 +30,13 @@ 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 |