Skip to content

Commit

Permalink
check the error failures #5
Browse files Browse the repository at this point in the history
  • Loading branch information
abtink committed Sep 3, 2023
1 parent 5c2f6e3 commit 337a1cd
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/mdns/mdns_avahi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -690,8 +690,13 @@ otbrError PublisherAvahi::PublishServiceImpl(const std::string &aHostName,

otbrLogInfo("Commit avahi service %s.%s", serviceName.c_str(), aType.c_str());
avahiError = avahi_entry_group_commit(group);

// Cauae a failure...
avahiError = AVAHI_ERR_INVALID_HOST_NAME;

VerifyOrExit(avahiError == AVAHI_OK);


AddServiceRegistration(std::unique_ptr<AvahiServiceRegistration>(new AvahiServiceRegistration(
aHostName, serviceName, aType, sortedSubTypeList, aPort, sortedTxtList, std::move(aCallback), group, this)));

Expand Down
33 changes: 31 additions & 2 deletions src/sdp_proxy/advertising_proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,16 @@ void AdvertisingProxy::PublishAllHostsAndServices(void)
return;
}

static void UpdateStuff(std::string &fullHostName, const otSrpServerHost *aHost)
{
fullHostName = otSrpServerHostGetFullName(aHost);
}

static void UpdateSevice(std::string &fullServiceName, const otSrpServerService *service)
{
fullServiceName = otSrpServerServiceGetInstanceName(service);
}

otbrError AdvertisingProxy::PublishHostAndItsServices(const otSrpServerHost *aHost, OutstandingUpdate *aUpdate)
{
otbrError error = OTBR_ERROR_NONE;
Expand All @@ -232,7 +242,16 @@ otbrError AdvertisingProxy::PublishHostAndItsServices(const otSrpServerHost *aHo
const otSrpServerService *service;
otSrpServerServiceUpdateId updateId = 0;
bool hasUpdate = false;
std::string fullHostName = otSrpServerHostGetFullName(aHost);
std::string fullHostName;

if (otSrpServerHostGetFullName(aHost) == nullptr)
{
otbrLogWarning("ABTIN ~~~ otSrpServerHostGetFullName() is null WHY?");
error = OTBR_ERROR_INVALID_ARGS;
ExitNow();
}

UpdateStuff(fullHostName, aHost);

otbrLogInfo("Advertise SRP service updates: host=%s", fullHostName.c_str());

Expand All @@ -256,11 +275,21 @@ otbrError AdvertisingProxy::PublishHostAndItsServices(const otSrpServerHost *aHo
service = nullptr;
while ((service = otSrpServerHostGetNextService(aHost, service)) != nullptr)
{
std::string fullServiceName = otSrpServerServiceGetInstanceName(service);
std::string fullServiceName;
std::string serviceName;
std::string serviceType;
std::string serviceDomain;

if (otSrpServerServiceGetInstanceName(service) == nullptr)
{
otbrLogWarning("ABTIN ~~~ otSrpServerServiceGetInstanceName() is null WHY?");
error = OTBR_ERROR_INVALID_ARGS;
ExitNow();
}

UpdateService(fullServiceName, service);
// fullServiceName = otSrpServerServiceGetInstanceName(service);

SuccessOrExit(error = SplitFullServiceInstanceName(fullServiceName, serviceName, serviceType, serviceDomain));

if (!hostDeleted && !otSrpServerServiceIsDeleted(service))
Expand Down

0 comments on commit 337a1cd

Please sign in to comment.