disconnect when we cannot read from the socket

This commit is contained in:
Ludovico Magnocavallo 2009-05-11 13:39:59 +02:00
parent ecfaf6da92
commit b062edf392
1 changed files with 3 additions and 0 deletions

View File

@ -880,6 +880,9 @@ class Redis(object):
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:])