ot-br-posix icon indicating copy to clipboard operation
ot-br-posix copied to clipboard

dbus client uses sync call to AttachAllNodesTo , but that method only supports async call (requires a Handler)

Open AlanLCollins opened this issue 1 year ago • 0 comments

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.

AlanLCollins avatar Jun 29 '23 16:06 AlanLCollins