|
40 | 40 | #include <platform/CHIPDeviceConfig.h>
|
41 | 41 | #include <platform/GLibTypeDeleter.h>
|
42 | 42 | #include <platform/PlatformManager.h>
|
| 43 | +#include <platform/CHIPDeviceLayer.h> |
43 | 44 |
|
44 | 45 | #include "ErrorUtils.h"
|
45 | 46 |
|
@@ -276,20 +277,6 @@ void GetTextEntries(unsigned short txtLen, uint8_t * txtRecord, std::vector<chip
|
276 | 277 | }
|
277 | 278 | }
|
278 | 279 |
|
279 |
| -static void HandleResolveTask(intptr_t context) |
280 |
| -{ |
281 |
| - ChipLogProgress(DeviceLayer, "DNSsd %s", __func__); |
282 |
| - auto rCtx = reinterpret_cast<chip::Dnssd::ResolveContext *>(context); |
283 |
| - if (!rCtx) |
284 |
| - { |
285 |
| - ChipLogError(DeviceLayer, "Null context in HandleResolveTask"); |
286 |
| - return; |
287 |
| - } |
288 |
| - |
289 |
| - rCtx->Finalize(CHIP_NO_ERROR); |
290 |
| - rCtx->mInstance->RemoveContext(rCtx); |
291 |
| -} |
292 |
| - |
293 | 280 | void OnResolve(dnssd_error_e result, dnssd_service_h service, void * userData)
|
294 | 281 | {
|
295 | 282 | ChipLogProgress(DeviceLayer, "DNSsd %s", __func__);
|
@@ -355,7 +342,12 @@ void OnResolve(dnssd_error_e result, dnssd_service_h service, void * userData)
|
355 | 342 |
|
356 | 343 | rCtx->mResult.mAddress.emplace(ipAddr);
|
357 | 344 |
|
358 |
| - err = chip::DeviceLayer::PlatformMgr().ScheduleWork(HandleResolveTask, reinterpret_cast<intptr_t>(rCtx)); |
| 345 | + err = chip::DeviceLayer::SystemLayer().ScheduleLambda([rCtx] { |
| 346 | + ChipLogProgress(DeviceLayer, "DNSsd Handle resolve task on schedule lambda"); |
| 347 | + |
| 348 | + rCtx->Finalize(CHIP_NO_ERROR); |
| 349 | + rCtx->mInstance->RemoveContext(rCtx); |
| 350 | + }); |
359 | 351 | VerifyOrExit(err == CHIP_NO_ERROR, ChipLogError(DeviceLayer, "Failed to schedule resolve task: %s", err.AsString()));
|
360 | 352 |
|
361 | 353 | return;
|
|
0 commit comments