Permalink
Browse files

disconnect when we cannot read from the socket

  • Loading branch information...
1 parent ecfaf6d commit b062edf392a70116031881f9af7a082d042a2dbd Ludovico Magnocavallo committed May 11, 2009
Showing with 3 additions and 0 deletions.
  1. +3 −0 client-libraries/python/redis.py
@@ -880,6 +880,9 @@ def info(self):
def get_response(self):
data = self._read().strip()
+ if not data:
+ self.disconnect()
+ raise ConnectionError("Socket closed on remote end")
c = data[0]
if c == '-':
raise ResponseError(data[5:] if data[:5] == '-ERR ' else data[1:])

1 comment on commit b062edf

tredoe commented on b062edf May 16, 2009

I think that would be better anything as:

def get_response(self):
    while 1:
      data = self._read().strip()
      if data:
          break

The disconnection should be run in the '_read' function.

Please sign in to comment.