Skip to content

Commit

Permalink
mdns.cpp - Semantic print fixes similar to mdns.h 23c6f01bb8c68e0e9f6…
Browse files Browse the repository at this point in the history
…c1ee17b7ae721344925ab
  • Loading branch information
talaviram committed Nov 4, 2024
1 parent e75c499 commit 5752792
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/mdns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ void mDNS::runMainLoop() {
}
if (!name_.ends_with(".")) name_ += ".";

MDNS_LOG << "Opened " << std::to_string(num_sockets) << " socket" << (num_sockets ? "s" : "")
MDNS_LOG << "Opened " << std::to_string(num_sockets) << " socket" << (num_sockets > 1 ? "s" : "")
<< " for mDNS service\n";
MDNS_LOG << "Service mDNS: " << name_ << ":" << port_ << "\n";
MDNS_LOG << "Hostname: " << hostname_.data() << "\n";
Expand Down Expand Up @@ -747,7 +747,7 @@ void mDNS::runMainLoop() {
for (int isock = 0; isock < num_sockets; ++isock) {
mdns_socket_close(sockets[isock]);
}
MDNS_LOG << "Closed socket " << (num_sockets ? "s" : "") << "\n";
MDNS_LOG << "Closed socket " << (num_sockets > 1 ? "s" : "") << "\n";
}

void mDNS::executeQuery(const ServiceQueries &serviceQueries) {
Expand All @@ -760,7 +760,7 @@ void mDNS::executeQuery(const ServiceQueries &serviceQueries) {
MDNS_LOG << msg << "\n";
throw std::runtime_error(msg);
}
MDNS_LOG << "Opened " << num_sockets << " socket" << (num_sockets ? "s" : "") << " for mDNS query\n";
MDNS_LOG << "Opened " << num_sockets << " socket" << (num_sockets > 1 ? "s" : "") << " for mDNS query\n";

size_t capacity = 2048;
void *buffer = malloc(capacity);
Expand Down Expand Up @@ -828,7 +828,7 @@ void mDNS::executeQuery(const ServiceQueries &serviceQueries) {
for (int isock = 0; isock < num_sockets; ++isock) {
mdns_socket_close(sockets[isock]);
}
MDNS_LOG << "Closed socket" << (num_sockets ? "s" : "") << "\n";
MDNS_LOG << "Closed socket" << (num_sockets > 1 ? "s" : "") << "\n";
}

void mDNS::executeDiscovery() {
Expand Down Expand Up @@ -886,7 +886,7 @@ void mDNS::executeDiscovery() {
for (int isock = 0; isock < num_sockets; ++isock) {
mdns_socket_close(sockets[isock]);
}
MDNS_LOG << "Closed socket" << (num_sockets ? "s" : "") << "\n";
MDNS_LOG << "Closed socket" << (num_sockets > 1 ? "s" : "") << "\n";
}

void mDNS::runDumpMode(int *sockets, const int num_sockets) {
Expand Down

0 comments on commit 5752792

Please sign in to comment.