From beef1b1e22b9c803016a9c6f8e6f5608cf217a49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Ma=C5=9Blanka?= <piotr.maslanka@henrietta.com.pl> Date: Fri, 3 Jan 2020 18:50:47 +0100 Subject: [PATCH] bugfix - a race condition --- CHANGELOG.md | 2 ++ coolamqp/uplink/connection/connection.py | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b805cfa..117fca2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ * significant docs update * cosmetics +* fixed a bug wherein on very much loaded systems `ConnectionStart` would arrive before + a watch could be registered for it # v0.99: diff --git a/coolamqp/uplink/connection/connection.py b/coolamqp/uplink/connection/connection.py index e658836..cf99595 100644 --- a/coolamqp/uplink/connection/connection.py +++ b/coolamqp/uplink/connection/connection.py @@ -173,14 +173,14 @@ class Connection(object): sock.settimeout(0) sock.send(b'AMQP\x00\x00\x09\x01') - self.listener_socket = self.listener_thread.register(sock, - on_read=self.recvf.put, - on_fail=self.on_fail) - self.sendf = SendingFramer(self.listener_socket.send) self.watch_for_method(0, (ConnectionClose, ConnectionCloseOk), self.on_connection_close) Handshaker(self, self.node_definition, self.on_connected, self.extra_properties) + self.listener_socket = self.listener_thread.register(sock, + on_read=self.recvf.put, + on_fail=self.on_fail) + self.sendf = SendingFramer(self.listener_socket.send) def on_fail(self): """ -- GitLab