From 13aa2e9aae58827f4d5b754e4c270b84d0dd0509 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 16 Jul 2018 11:58:18 -0400 Subject: [PATCH] Catch more broad errors Operating on a closed socket is not a socket.error --- confluent_server/confluent/config/configmanager.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/confluent_server/confluent/config/configmanager.py b/confluent_server/confluent/config/configmanager.py index d281fafa..c6946686 100644 --- a/confluent_server/confluent/config/configmanager.py +++ b/confluent_server/confluent/config/configmanager.py @@ -68,7 +68,6 @@ import operator import os import random import re -import eventlet.green.socket as socket import string import struct import sys @@ -474,7 +473,7 @@ def relay_slaved_requests(name, listener): cfgstreams[name] = listener try: msg = listener.recv(8) - except socket.error: + except Exception: msg = None while msg: if name not in cfgstreams: @@ -493,7 +492,7 @@ def relay_slaved_requests(name, listener): _push_rpc(listener, cPickle.dumps({'xid': rpc['xid']})) try: msg = listener.recv(8) - except socket.error: + except Exception: msg = None finally: try: @@ -581,7 +580,7 @@ def follow_channel(channel): stop_following(channel) try: msg = channel.recv(8) - except socket.error: + except Exception: msg = None while msg: sz = struct.unpack('!Q', msg)[0] @@ -601,7 +600,7 @@ def follow_channel(channel): _pendingchangesets[rpc['xid']].send() try: msg = channel.recv(8) - except socket.error: + except Exception: msg = None # mark the connection as broken stop_following(True)