Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🩹 zm: do not reply if no-reply-expected flag is set
I am using zbus to define an inteface method, like this: ```rust impl SettingsInterface { async fn set_var( &self, originator: &str, object: &str, interface: &str, arguments: &str, ) { //... } } ``` This method is called with with the `NoReplyExpected` flag. However zbus generates a reply, which ended up in an error shown in `dbus-monitor`: ``` Rejected send message, 0 matched rules; type="method_return", sender=":1.16" ... ``` I used `cargo expand` to see what code is generated by the interface macros and found something like this: ```rust let reply = self.set_var(originator, object, interface, arguments).await; let hdr = message.header(); connection.reply(&hdr, &reply).await ``` The `connection.reply()` method is called in every case. So i guess, that the flag is not evaluated yet, to handle the case where no response is expected!? With my adjustment, the generated code looks like this: ```rust let reply = self.set_var(originator, object, interface, arguments).await; let hdr = message.header(); if hdr.primary().flags().contains(zbus::message::Flags::NoReplyExpected) { Ok(()) } else { connection.reply(&hdr, &reply).await } ``` And the error shown with `dbus-monitor` was gone.
- Loading branch information