diff --git a/CHANGES b/CHANGES index ead10c1263..09204c9177 100644 --- a/CHANGES +++ b/CHANGES @@ -3,7 +3,12 @@ Thanks leifkb. * Added SENTINEL command. Thanks Anna Janackova. * Fixed a bug where pipelines could potentially correct a connection - if the MULTI command generated a ResponseError + if the MULTI command generated a ResponseError. Thanks EliFinkelshteyn + for the report. + * Connections now call socket.shutdown() prior to socket.close() to + ensure communication ends immediately per the note at + http://docs.python.org/2/library/socket.html#socket.socket.close + Thanks to David Martin for pointing this out. * 2.7.6 * Added CONFIG RESETSTAT command. Thanks Yossi Gottlieb. * Fixed a bug introduced in 2.7.3 that caused issues with script objects diff --git a/redis/connection.py b/redis/connection.py index 3a7ca81f82..45d4e463e9 100644 --- a/redis/connection.py +++ b/redis/connection.py @@ -276,6 +276,7 @@ def disconnect(self): if self._sock is None: return try: + self._sock.shutdown(socket.SHUT_RDWR) self._sock.close() except socket.error: pass