Skip to content

Commit

Permalink
Remove LogErrorOnFailure
Browse files Browse the repository at this point in the history
  • Loading branch information
andy31415 committed Mar 17, 2022
1 parent 86093fd commit b726abc
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions src/lib/dnssd/Advertiser_ImplMinimalMdns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,19 @@ class AdvertiserMinMdns : public ServiceAdvertiser,
AdvertiserMinMdns() : mResponseSender(&GlobalMinimalMdnsServer::Server())
{
GlobalMinimalMdnsServer::Instance().SetQueryDelegate(this);
LogErrorOnFailure(mResponseSender.AddQueryResponder(mQueryResponderAllocatorCommissionable.GetQueryResponder()));
LogErrorOnFailure(mResponseSender.AddQueryResponder(mQueryResponderAllocatorCommissioner.GetQueryResponder()));

CHIP_ERROR err = mResponseSender.AddQueryResponder(mQueryResponderAllocatorCommissionable.GetQueryResponder());

if (err != CHIP_NO_ERROR)
{
ChipLogError(Discovery, "Failed to setup commissionable responder: %" CHIP_ERROR_FORMAT, err.Format());
}

err = mResponseSender.AddQueryResponder(mQueryResponderAllocatorCommissioner.GetQueryResponder());
if (err != CHIP_NO_ERROR)
{
ChipLogError(Discovery, "Failed to setup commissioner responder: %" CHIP_ERROR_FORMAT, err.Format());
}
}
~AdvertiserMinMdns() override {}

Expand Down Expand Up @@ -342,7 +353,13 @@ CHIP_ERROR AdvertiserMinMdns::RemoveServices()

// Mark as unused
ptr->GetAllocator()->Clear();
LogErrorOnFailure(mResponseSender.RemoveQueryResponder(ptr->GetAllocator()->GetQueryResponder()));

CHIP_ERROR err = mResponseSender.RemoveQueryResponder(ptr->GetAllocator()->GetQueryResponder());
if (err != CHIP_NO_ERROR)
{
ChipLogError(Discovery, "Failed to remove query responder: %" CHIP_ERROR_FORMAT, err.Format());
}

mOperationalResponders.Remove(ptr);

// Finally release the memory
Expand Down

0 comments on commit b726abc

Please sign in to comment.