feat: small speed ups to unmarshall message creation (#27)
This commit is contained in:
parent
8e8a48832e
commit
0bce72a76a
@ -318,6 +318,9 @@ class Unmarshaller:
|
||||
signature=tree.signature,
|
||||
body=[self.read_argument(t) for t in tree.types] if self.body_len else [],
|
||||
serial=self.serial,
|
||||
# The D-Bus implementation already validates the message,
|
||||
# so we don't need to do it again.
|
||||
validate=False,
|
||||
)
|
||||
|
||||
def unmarshall(self):
|
||||
|
||||
@ -108,6 +108,7 @@ class Message:
|
||||
signature: str = "",
|
||||
body: List[Any] = [],
|
||||
serial: int = 0,
|
||||
validate: bool = True,
|
||||
):
|
||||
self.destination = destination
|
||||
self.path = path
|
||||
@ -134,6 +135,8 @@ class Message:
|
||||
self.body = body
|
||||
self.serial = serial
|
||||
|
||||
if not validate:
|
||||
return
|
||||
if self.destination is not None:
|
||||
assert_bus_name_valid(self.destination)
|
||||
if self.interface is not None:
|
||||
|
||||
@ -765,10 +765,10 @@ class BaseMessageBus:
|
||||
|
||||
if msg.message_type == MessageType.SIGNAL:
|
||||
if msg._matches(
|
||||
member="NameOwnerChanged", # least likely to match
|
||||
sender="org.freedesktop.DBus",
|
||||
path="/org/freedesktop/DBus",
|
||||
interface="org.freedesktop.DBus",
|
||||
member="NameOwnerChanged",
|
||||
):
|
||||
[name, old_owner, new_owner] = msg.body
|
||||
if new_owner:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user