fix: handling of None messages from notify callback (#236)
Co-authored-by: Remy Noel <remy.noel@blade-group.com> Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
@@ -1194,7 +1194,7 @@ class BaseMessageBus:
|
|||||||
logging.error(
|
logging.error(
|
||||||
f'add match request failed. match="{self._name_owner_match_rule}", {err}'
|
f'add match request failed. match="{self._name_owner_match_rule}", {err}'
|
||||||
)
|
)
|
||||||
if msg.message_type == MessageType.ERROR:
|
elif msg.message_type == MessageType.ERROR:
|
||||||
logging.error(
|
logging.error(
|
||||||
f'add match request failed. match="{self._name_owner_match_rule}", {msg.body[0]}'
|
f'add match request failed. match="{self._name_owner_match_rule}", {msg.body[0]}'
|
||||||
)
|
)
|
||||||
@@ -1228,7 +1228,7 @@ class BaseMessageBus:
|
|||||||
def add_match_notify(msg: Message, err: Optional[Exception]) -> None:
|
def add_match_notify(msg: Message, err: Optional[Exception]) -> None:
|
||||||
if err:
|
if err:
|
||||||
logging.error(f'add match request failed. match="{match_rule}", {err}')
|
logging.error(f'add match request failed. match="{match_rule}", {err}')
|
||||||
if msg.message_type == MessageType.ERROR:
|
elif msg.message_type == MessageType.ERROR:
|
||||||
logging.error(
|
logging.error(
|
||||||
f'add match request failed. match="{match_rule}", {msg.body[0]}'
|
f'add match request failed. match="{match_rule}", {msg.body[0]}'
|
||||||
)
|
)
|
||||||
@@ -1267,7 +1267,7 @@ class BaseMessageBus:
|
|||||||
logging.error(
|
logging.error(
|
||||||
f'remove match request failed. match="{match_rule}", {err}'
|
f'remove match request failed. match="{match_rule}", {err}'
|
||||||
)
|
)
|
||||||
if msg.message_type == MessageType.ERROR:
|
elif msg.message_type == MessageType.ERROR:
|
||||||
logging.error(
|
logging.error(
|
||||||
f'remove match request failed. match="{match_rule}", {msg.body[0]}'
|
f'remove match request failed. match="{match_rule}", {msg.body[0]}'
|
||||||
)
|
)
|
||||||
|
|||||||
26
tests/client/test_aio.py
Normal file
26
tests/client/test_aio.py
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
import pytest
|
||||||
|
|
||||||
|
from dbus_fast import aio
|
||||||
|
from dbus_fast.service import ServiceInterface
|
||||||
|
|
||||||
|
|
||||||
|
class ExampleInterface(ServiceInterface):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__("test.interface")
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.asyncio
|
||||||
|
async def test_fast_disconnect():
|
||||||
|
bus_name = "aio.client.test.methods"
|
||||||
|
|
||||||
|
bus = await aio.MessageBus().connect()
|
||||||
|
bus2 = await aio.MessageBus().connect()
|
||||||
|
await bus.request_name(bus_name)
|
||||||
|
service_interface = ExampleInterface()
|
||||||
|
bus.export("/test/path", service_interface)
|
||||||
|
introspection = await bus2.introspect(bus_name, "/test/path")
|
||||||
|
bus2.get_proxy_object(bus_name, "/test/path", introspection)
|
||||||
|
bus2.disconnect()
|
||||||
|
bus.disconnect()
|
||||||
|
await bus.wait_for_disconnect()
|
||||||
|
await bus2.wait_for_disconnect()
|
||||||
@@ -121,6 +121,8 @@ async def test_aio_proxy_object():
|
|||||||
|
|
||||||
bus.disconnect()
|
bus.disconnect()
|
||||||
bus2.disconnect()
|
bus2.disconnect()
|
||||||
|
await bus.wait_for_disconnect()
|
||||||
|
await bus2.wait_for_disconnect()
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
|
|||||||
Reference in New Issue
Block a user