|
|
1b42356 |
--- /kombu/transport/qpid.py 2016-04-01 16:59:49.698901199 -0400
|
|
|
1b42356 |
+++ /kombu/transport/qpid.py.modified 2016-04-01 16:59:43.643873453 -0400
|
|
|
1b42356 |
@@ -1396,6 +1396,7 @@
|
|
|
1b42356 |
self.r, self._w = os.pipe()
|
|
|
1b42356 |
if fcntl is not None:
|
|
|
1b42356 |
fcntl.fcntl(self.r, fcntl.F_SETFL, os.O_NONBLOCK)
|
|
|
1b42356 |
+ self.use_async_interface = False
|
|
|
1b42356 |
|
|
|
1b42356 |
def verify_runtime_environment(self):
|
|
|
1b42356 |
"""Verify that the runtime environment is acceptable.
|
|
|
1b42356 |
@@ -1435,10 +1436,12 @@
|
|
|
1b42356 |
'qpid-python`.')
|
|
|
1b42356 |
|
|
|
1b42356 |
def _qpid_message_ready_handler(self, session):
|
|
|
1b42356 |
- os.write(self._w, '0')
|
|
|
1b42356 |
+ if self.use_async_interface:
|
|
|
1b42356 |
+ os.write(self._w, '0')
|
|
|
1b42356 |
|
|
|
1b42356 |
def _qpid_async_exception_notify_handler(self, obj_with_exception, exc):
|
|
|
1b42356 |
- os.write(self._w, 'e')
|
|
|
1b42356 |
+ if self.use_async_interface:
|
|
|
1b42356 |
+ os.write(self._w, 'e')
|
|
|
1b42356 |
|
|
|
1b42356 |
def on_readable(self, connection, loop):
|
|
|
1b42356 |
"""Handle any messages associated with this Transport.
|
|
|
1b42356 |
@@ -1519,6 +1522,7 @@
|
|
|
1b42356 |
:param loop: A reference to the external loop.
|
|
|
1b42356 |
:type loop: kombu.async.hub.Hub
|
|
|
1b42356 |
"""
|
|
|
1b42356 |
+ self.use_async_interface = True
|
|
|
1b42356 |
loop.add_reader(self.r, self.on_readable, connection, loop)
|
|
|
1b42356 |
|
|
|
1b42356 |
def establish_connection(self):
|
|
|
1b42356 |
--- /kombu/tests/transport/test_qpid.py 2016-04-01 17:10:59.140637210 -0400
|
|
|
1b42356 |
+++ /kombu/tests/transport/test_qpid.py.modified 2016-04-01 17:13:40.708274142 -0400
|
|
|
1b42356 |
@@ -1788,6 +1788,7 @@
|
|
|
1b42356 |
self.patch_a = patch(QPID_MODULE + '.os.write')
|
|
|
1b42356 |
self.mock_os_write = self.patch_a.start()
|
|
|
1b42356 |
self.transport = Transport(Mock())
|
|
|
1b42356 |
+ self.transport.register_with_event_loop(Mock(), Mock())
|
|
|
1b42356 |
|
|
|
1b42356 |
def tearDown(self):
|
|
|
1b42356 |
self.patch_a.stop()
|