summaryrefslogtreecommitdiff
path: root/amqp/connection.py
diff options
context:
space:
mode:
Diffstat (limited to 'amqp/connection.py')
-rw-r--r--amqp/connection.py32
1 files changed, 14 insertions, 18 deletions
diff --git a/amqp/connection.py b/amqp/connection.py
index 5b3a4d1..9917ec7 100644
--- a/amqp/connection.py
+++ b/amqp/connection.py
@@ -466,24 +466,20 @@ class Connection(AbstractChannel):
return self._transport and self._transport.connected
def collect(self):
- try:
- if self._transport:
- self._transport.close()
-
- if self.channels:
- # Copy all the channels except self since the channels
- # dictionary changes during the collection process.
- channels = [
- ch for ch in self.channels.values()
- if ch is not self
- ]
-
- for ch in channels:
- ch.collect()
- except OSError:
- pass # connection already closed on the other end
- finally:
- self._transport = self.connection = self.channels = None
+ if self._transport:
+ self._transport.close()
+
+ if self.channels:
+ # Copy all the channels except self since the channels
+ # dictionary changes during the collection process.
+ channels = [
+ ch for ch in self.channels.values()
+ if ch is not self
+ ]
+
+ for ch in channels:
+ ch.collect()
+ self._transport = self.connection = self.channels = None
def _get_free_channel_id(self):
try: