diff --git a/coolamqp/attaches/channeler.py b/coolamqp/attaches/channeler.py index 74fb96d10619bf155c43247a985e49c3da8a1b17..791f5f5b81eed3077e2fc353bc4a67caca41ef77 100644 --- a/coolamqp/attaches/channeler.py +++ b/coolamqp/attaches/channeler.py @@ -151,7 +151,9 @@ class Channeler(Attache): But moar performant. """ - assert self.channel_id is not None + if self.channel_id is None: + return # advanced teardown xD + frames = [AMQPMethodFrame(self.channel_id, payload) for payload in payloads] self.connection.send(frames) diff --git a/coolamqp/clustering/single.py b/coolamqp/clustering/single.py index 9fbb9e2683e8dd4c71ce7e977edee500c0cbd47a..a15b5c6a5f85ce40564245fe2a1ab465a119214a 100644 --- a/coolamqp/clustering/single.py +++ b/coolamqp/clustering/single.py @@ -37,4 +37,6 @@ class SingleNodeReconnector(object): def shutdown(self): """Close this connection""" - self.connection.send(None) + if self.connection is not None: + self.connection.send(None) + self.connection = None diff --git a/coolamqp/framing/compilation/__init__.py b/coolamqp/framing/compilation/__init__.py index c932491a7c750218a3d62edb6656415c22a09be1..935f6982dab8906e875c41282d90a84ce549d57a 100644 --- a/coolamqp/framing/compilation/__init__.py +++ b/coolamqp/framing/compilation/__init__.py @@ -1,5 +1,6 @@ # coding=UTF-8 from __future__ import absolute_import, division, print_function """ -Function that compiles amqp0-9-1.xml to definitions.py +- Compile XML to definitions.py +- Dynamically compile classes from property_flags """ \ No newline at end of file diff --git a/coolamqp/objects.py b/coolamqp/objects.py index dda8ea5f1033a15b731971ff1120c228b239773f..0b911ab01c95217647099c3aaba3bfa5c26dc3a9 100644 --- a/coolamqp/objects.py +++ b/coolamqp/objects.py @@ -183,6 +183,7 @@ class Future(concurrent.futures.Future): def result(self, timeout=None): assert timeout is None, u'Non-none timeouts not supported' self.lock.acquire() + self.lock.release() if self.completed: if self.successfully: diff --git a/tests/test_framing/test_definitions/test_cpl.py b/tests/test_framing/test_definitions/test_cpl.py index 03b8e9f12830f200aa25a6cc9823acb856ee4acf..2f865778251f20fbefc6f472f16743f3a332e839 100644 --- a/tests/test_framing/test_definitions/test_cpl.py +++ b/tests/test_framing/test_definitions/test_cpl.py @@ -1,6 +1,7 @@ # coding=UTF-8 from __future__ import absolute_import, division, print_function import unittest +import struct import io @@ -29,4 +30,4 @@ class TestBasicContentPropertyList(unittest.TestCase): bcpl.write_to(buf) ser = buf.getvalue() - self.assertEquals(ser, '\x80\x00' + chr(len('text/plain')) + b'text/plain') + self.assertEquals(ser, b'\x80\x00' + struct.pack('!B', len('text/plain')) + b'text/plain')