docs: enhance domain discovery output and reachability probing
This commit is contained in:
26
src/main.cpp
26
src/main.cpp
@@ -54,24 +54,31 @@ int main(int argc, char** argv) {
|
|||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
std::cout << "[Discovery] Found " << domains.size() << " candidate domain(s):" << std::endl;
|
std::cout << "[Discovery] Found " << domains.size() << " candidate domain(s):" << std::endl;
|
||||||
int idx = 0;
|
|
||||||
for (const auto& d : domains) {
|
// Limit display to first 10
|
||||||
std::cout << " [" << idx++ << "] "
|
int displayLimit = std::min(10, (int)domains.size());
|
||||||
|
for (int idx = 0; idx < displayLimit; ++idx) {
|
||||||
|
const auto& d = domains[idx];
|
||||||
|
std::cout << " [" << idx << "] "
|
||||||
<< (d.name.empty() ? d.networkHost : d.name)
|
<< (d.name.empty() ? d.networkHost : d.name)
|
||||||
<< " -> ws://" << d.networkHost << ":" << d.httpPort
|
<< " -> ws://" << d.networkHost << ":" << d.httpPort
|
||||||
<< " (udp:" << d.udpPort << ")" << std::endl;
|
<< " (udp:" << d.udpPort << ")" << std::endl;
|
||||||
}
|
}
|
||||||
|
if ((int)domains.size() > displayLimit) {
|
||||||
|
std::cout << " ... and " << (domains.size() - displayLimit) << " more domains" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
// Probe for reachability unless disabled
|
// Probe for reachability unless disabled (disabled by default for large lists)
|
||||||
bool probeEnabled = true;
|
bool probeEnabled = false; // Default: disabled for performance
|
||||||
if (const char* envProbe = std::getenv("OVERTE_DISCOVER_PROBE")) {
|
if (const char* envProbe = std::getenv("OVERTE_DISCOVER_PROBE")) {
|
||||||
if (std::string(envProbe) == "0" || std::string(envProbe) == "false") probeEnabled = false;
|
if (std::string(envProbe) == "1" || std::string(envProbe) == "true") probeEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int choice = -1;
|
int choice = -1;
|
||||||
if (probeEnabled) {
|
if (probeEnabled) {
|
||||||
std::cout << "[Discovery] Probing domains for reachability..." << std::endl;
|
std::cout << "[Discovery] Probing domains for reachability (limit 20)..." << std::endl;
|
||||||
for (size_t i = 0; i < domains.size(); ++i) {
|
int probeLimit = std::min(20, (int)domains.size());
|
||||||
|
for (int i = 0; i < probeLimit; ++i) {
|
||||||
std::cout << "[Discovery] Probing [" << i << "] " << domains[i].networkHost << ":" << domains[i].httpPort << "... " << std::flush;
|
std::cout << "[Discovery] Probing [" << i << "] " << domains[i].networkHost << ":" << domains[i].httpPort << "... " << std::flush;
|
||||||
if (probeDomain(domains[i])) {
|
if (probeDomain(domains[i])) {
|
||||||
std::cout << "REACHABLE" << std::endl;
|
std::cout << "REACHABLE" << std::endl;
|
||||||
@@ -82,11 +89,12 @@ int main(int argc, char** argv) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (choice < 0) {
|
if (choice < 0) {
|
||||||
std::cout << "[Discovery] No reachable domains found; using first candidate anyway." << std::endl;
|
std::cout << "[Discovery] No reachable domains found in first " << probeLimit << "; using first candidate." << std::endl;
|
||||||
choice = 0;
|
choice = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
std::cout << "[Discovery] Probing disabled; selecting first candidate." << std::endl;
|
std::cout << "[Discovery] Probing disabled; selecting first candidate." << std::endl;
|
||||||
|
std::cout << "[Discovery] Set OVERTE_DISCOVER_PROBE=1 to enable reachability testing." << std::endl;
|
||||||
choice = 0;
|
choice = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user