From 2816041db67e6d725b6de0c640999eb45f49ace2 Mon Sep 17 00:00:00 2001 From: bluebin14 <80577827+bluebin14@users.noreply.github.com> Date: Mon, 30 May 2022 18:46:41 +0200 Subject: [PATCH] MdnsAvahi: do not fail when instance is reinited (#18670) * MdnsAvahi: do not fail when avahi is restarted (seen with TE9 image in several configurations) * MdnsAvahi: log Shutdown error as requested --- src/platform/Linux/DnssdImpl.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/platform/Linux/DnssdImpl.cpp b/src/platform/Linux/DnssdImpl.cpp index f98c83adb118be..0ae581cc09b976 100644 --- a/src/platform/Linux/DnssdImpl.cpp +++ b/src/platform/Linux/DnssdImpl.cpp @@ -328,6 +328,11 @@ CHIP_ERROR MdnsAvahi::Init(DnssdAsyncReturnCallback initCallback, DnssdAsyncRetu CHIP_ERROR error = CHIP_NO_ERROR; int avahiError = 0; + if (Shutdown() != CHIP_NO_ERROR) + { + ChipLogError(DeviceLayer, "Shutdown() failed, continue anyway..."); + } + VerifyOrExit(initCallback != nullptr, error = CHIP_ERROR_INVALID_ARGUMENT); VerifyOrExit(errorCallback != nullptr, error = CHIP_ERROR_INVALID_ARGUMENT); VerifyOrExit(mClient == nullptr && mGroup == nullptr, error = CHIP_ERROR_INCORRECT_STATE);