ot-br-posix
ot-br-posix copied to clipboard
dbus client uses sync call to AttachAllNodesTo , but that method only supports async call (requires a Handler)
Describe the bug dbus client uses sync call to AttachAllNodesTo , but that method only supports async call (requires a Handler)
ThreadApiDBus used Sync Method because it does not receive Handler parameter:
ClientError ThreadApiDBus::AttachAllNodesTo(const std::vector<uint8_t> &aDataset)
{
auto args = std::tie(aDataset);
return CallDBusMethodSync(OTBR_DBUS_ATTACH_ALL_NODES_TO_METHOD, args);
}
ThreadHelper only support Async Method, so all attempts of use will fail with "Invalid args" error.
void ThreadHelper::AttachAllNodesTo(const std::vector<uint8_t> &aDatasetTlvs, AttachHandler aHandler)
{
....
if (aHandler == nullptr)
{
otbrLogWarning("Attach Handler is nullptr");
ExitNow(error = OT_ERROR_INVALID_ARGS);
}
...
I will push a PR soon, which modifies the ThreadApiDBus to receive a Handler and calls Async Method. Please let me know if you identify a better solution.