summaryrefslogtreecommitdiff
path: root/redis/connection.py
diff options
context:
space:
mode:
Diffstat (limited to 'redis/connection.py')
-rwxr-xr-xredis/connection.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/redis/connection.py b/redis/connection.py
index 6c4494b..1bb8eb5 100755
--- a/redis/connection.py
+++ b/redis/connection.py
@@ -717,9 +717,14 @@ class Connection:
self._parser.on_disconnect()
if self._sock is None:
return
- try:
- if os.getpid() == self.pid:
+
+ if os.getpid() == self.pid:
+ try:
self._sock.shutdown(socket.SHUT_RDWR)
+ except OSError:
+ pass
+
+ try:
self._sock.close()
except OSError:
pass