From d8f3cdc9c7264921909ceea78d9be83e84540f70 Mon Sep 17 00:00:00 2001
From: Piotr Maslanka <piotr.maslanka@henrietta.com.pl>
Date: Tue, 10 Jan 2017 23:19:57 +0100
Subject: [PATCH] huntin' and loggin'

---
 coolamqp/clustering/cluster.py             | 1 +
 coolamqp/uplink/connection/connection.py   | 5 ++++-
 coolamqp/uplink/handshake.py               | 2 +-
 coolamqp/uplink/listener/epoll_listener.py | 3 ++-
 setup.py                                   | 4 ++--
 5 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/coolamqp/clustering/cluster.py b/coolamqp/clustering/cluster.py
index 19fea7b..63cc8ff 100644
--- a/coolamqp/clustering/cluster.py
+++ b/coolamqp/clustering/cluster.py
@@ -145,6 +145,7 @@ class Cluster(object):
         Terminate all connections, release resources - finish the job.
         :param wait: block until this is done
         """
+        logger.info('Commencing shutdown')
 
         self.snr.shutdown()
         self.listener.terminate()
diff --git a/coolamqp/uplink/connection/connection.py b/coolamqp/uplink/connection/connection.py
index 1c29356..7fac7c2 100644
--- a/coolamqp/uplink/connection/connection.py
+++ b/coolamqp/uplink/connection/connection.py
@@ -249,7 +249,10 @@ class Connection(object):
         be called, and everything will process according to
         ListenerThread's on_fail callback.
         """
-        self.listener_socket.oneshot(delay, callback)
+        try:
+            self.listener_socket.oneshot(delay, callback)
+        except AttributeError:
+            print(dir(self))
 
     def unwatch_all(self, channel_id):
         """
diff --git a/coolamqp/uplink/handshake.py b/coolamqp/uplink/handshake.py
index 083dcfe..2571180 100644
--- a/coolamqp/uplink/handshake.py
+++ b/coolamqp/uplink/handshake.py
@@ -22,7 +22,7 @@ CLIENT_DATA = [
         # because RabbitMQ is some kind of a fascist and does not allow
         # these fields to be of type short-string
         (b'product', (b'CoolAMQP', 'S')),
-        (b'version', (b'develop', 'S')),
+        (b'version', (b'0.81', 'S')),
         (b'copyright', (b'Copyright (C) 2016-2017 DMS Serwis', 'S')),
         (b'information', (b'Licensed under the MIT License.\nSee https://github.com/smok-serwis/coolamqp for details', 'S')),
         (b'capabilities', ([(capa, (True, 't')) for capa in SUPPORTED_EXTENSIONS], 'F')),
diff --git a/coolamqp/uplink/listener/epoll_listener.py b/coolamqp/uplink/listener/epoll_listener.py
index a27095e..b5d3e1c 100644
--- a/coolamqp/uplink/listener/epoll_listener.py
+++ b/coolamqp/uplink/listener/epoll_listener.py
@@ -112,12 +112,13 @@ class EpollListener(object):
 
         This object is unusable after this call.
         """
+        self.time_events = []
         for sock in six.itervalues(self.fd_to_sock):
             sock.on_fail()
             sock.close()
+
         self.fd_to_sock = {}
         self.epoll.close()
-        self.time_events = []
 
     def oneshot(self, sock, delta, callback):
         """
diff --git a/setup.py b/setup.py
index 0fd9dcc..49dda78 100644
--- a/setup.py
+++ b/setup.py
@@ -4,12 +4,12 @@ from setuptools import setup
 
 
 setup(name=u'CoolAMQP',
-      version='0.80',
+      version='0.81',
       description=u'The fastest AMQP client',
       author=u'DMS Serwis s.c.',
       author_email=u'piotrm@smok.co',
       url=u'https://github.com/smok-serwis/coolamqp',
-      download_url='https://github.com/smok-serwis/coolamqp/archive/v0.80.zip',
+      download_url='https://github.com/smok-serwis/coolamqp/archive/v0.81.zip',
       keywords=['amqp', 'rabbitmq', 'client', 'network', 'ha', 'high availability'],
       packages=[
           'coolamqp',
-- 
GitLab