Commit 3320fe8e authored by Antoine Millet's avatar Antoine Millet

Fixed bug when recving on an "empty" socket.

parent 7ae1d6eb
......@@ -112,11 +112,20 @@ class RpcConnection(object):
Receive data from socket into the inbound buffer. If data can be
decoded, do it and pass result to :meth:`dispatch` method.
'''
buf = self._sock.recv(RpcConnection.RECV_BUF_SIZE)
try:
buf = self._sock.recv(RpcConnection.RECV_BUF_SIZE)
except socket.error as err:
if err.errno == 11:
# Errno 11 -> retry again
logging.warning('Non critical error while reading a socket:'
' %r', err)
return
if not buf:
# Empty buffer = closed socket.
raise socket.error()
self._inbound_buffer.push(buf)
# Read the message length:
if self._cur_msg_size is None and len(self._inbound_buffer) >= 4:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment