Skip to content

Commit

Permalink
Merge branch 'maint'
Browse files Browse the repository at this point in the history
  • Loading branch information
guruofquality committed Jul 6, 2020
2 parents 868dddd + 36293aa commit cfaf555
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Release 0.5.2 (pending)
==========================

- Handle cases where avahi client is null
- Protect getServerURLs() with mutex
- Handle EINTR case for SSDP server select
- Fix the scale in CS12 - CF32 conversion
- Protect getServerURLs from re-entrant calls
Expand Down
5 changes: 5 additions & 0 deletions common/SoapyMDNSEndpointAvahi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ SoapyMDNSEndpoint::~SoapyMDNSEndpoint(void)
void SoapyMDNSEndpoint::printInfo(void)
{
//summary of avahi client connection for server logging
if (_impl->client == nullptr) return;
SoapySDR::logf(SOAPY_SDR_INFO, "Avahi version: %s", avahi_client_get_version_string(_impl->client));
SoapySDR::logf(SOAPY_SDR_INFO, "Avahi hostname: %s", avahi_client_get_host_name(_impl->client));
SoapySDR::logf(SOAPY_SDR_INFO, "Avahi domain: %s", avahi_client_get_domain_name(_impl->client));
Expand All @@ -179,11 +180,13 @@ void SoapyMDNSEndpoint::printInfo(void)

bool SoapyMDNSEndpoint::status(void)
{
if (_impl->client == nullptr) return false;
return avahi_client_get_state(_impl->client) != AVAHI_CLIENT_FAILURE;
}

void SoapyMDNSEndpoint::registerService(const std::string &uuid, const std::string &service, const int ipVer)
{
if (_impl->client == nullptr) return;
auto &client = _impl->client;
auto &group = _impl->group;
group = avahi_entry_group_new(client, &groupCallback, this);
Expand Down Expand Up @@ -372,6 +375,8 @@ static void browserCallback(

std::map<std::string, std::map<int, std::string>> SoapyMDNSEndpoint::getServerURLs(const int ipVerReq, const long timeoutUs)
{
if (_impl->client == nullptr) return {};

const auto exitTime = std::chrono::high_resolution_clock::now() + std::chrono::microseconds(timeoutUs);
std::lock_guard<std::recursive_mutex> l(_impl->mutex);

Expand Down

0 comments on commit cfaf555

Please sign in to comment.