diff --git a/src/controller/python/ChipDeviceController-Discovery.cpp b/src/controller/python/ChipDeviceController-Discovery.cpp index a9fc93b2fbc40b..7b502140a36bb6 100644 --- a/src/controller/python/ChipDeviceController-Discovery.cpp +++ b/src/controller/python/ChipDeviceController-Discovery.cpp @@ -89,6 +89,11 @@ PyChipError pychip_DeviceController_DiscoverCommissionableNodes(Controller::Devi return ToPyChipError(devCtrl->DiscoverCommissionableNodes(filter)); } +PyChipError pychip_DeviceController_StopCommissionableDiscovery(Controller::DeviceCommissioner * devCtrl) +{ + return ToPyChipError(devCtrl->StopCommissionableDiscovery()); +} + void pychip_DeviceController_IterateDiscoveredCommissionableNodes(Controller::DeviceCommissioner * devCtrl, IterateDiscoveredCommissionableNodesFunct cb) { diff --git a/src/controller/python/chip/ChipDeviceCtrl.py b/src/controller/python/chip/ChipDeviceCtrl.py index 20e21177fe2b1d..402f2b7cea694d 100644 --- a/src/controller/python/chip/ChipDeviceCtrl.py +++ b/src/controller/python/chip/ChipDeviceCtrl.py @@ -594,6 +594,9 @@ def DiscoverCommissionableNodes(self, filterType: discovery.FilterType = discove else: time.sleep(timeoutSecond) + self._ChipStack.Call( + lambda: self._dmLib.pychip_DeviceController_StopCommissionableDiscovery(self.devCtrl)).raise_on_error() + return self.GetDiscoveredDevices() def DiscoverCommissionableNodesLongDiscriminator(self, long_discriminator): @@ -1567,6 +1570,10 @@ def _InitLib(self): c_void_p, c_uint8, c_char_p] self._dmLib.pychip_DeviceController_DiscoverCommissionableNodes.restype = PyChipError + self._dmLib.pychip_DeviceController_StopCommissionableDiscovery.argtypes = [ + c_void_p] + self._dmLib.pychip_DeviceController_StopCommissionableDiscovery.restype = PyChipError + self._dmLib.pychip_DeviceController_DiscoverCommissionableNodesLongDiscriminator.argtypes = [ c_void_p, c_uint16] self._dmLib.pychip_DeviceController_DiscoverCommissionableNodesLongDiscriminator.restype = PyChipError diff --git a/src/platform/Linux/DnssdImpl.cpp b/src/platform/Linux/DnssdImpl.cpp index 5f46dd24d8728f..2a1873072fbb9e 100644 --- a/src/platform/Linux/DnssdImpl.cpp +++ b/src/platform/Linux/DnssdImpl.cpp @@ -893,7 +893,7 @@ void MdnsAvahi::HandleResolve(AvahiServiceResolver * resolver, AvahiIfIndex inte avahi_service_resolver_free(resolver); context->mResolver = avahi_service_resolver_new( context->mInstance->mClient, context->mInterface, context->mTransport, context->mName, context->mFullType.c_str(), - nullptr, context->mAddressType, static_cast(0), HandleResolve, context); + nullptr, context->mAddressType, static_cast(0), HandleResolve, userdata); if (context->mResolver == nullptr) { ChipLogError(DeviceLayer, "Avahi resolve failed on retry");