Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(501)

Unified Diff: webrtc/p2p/stunprober/main.cc

Issue 1166013002: Better determination of Symmetric NAT (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/p2p/stunprober/stunprober.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/stunprober/main.cc
diff --git a/webrtc/p2p/stunprober/main.cc b/webrtc/p2p/stunprober/main.cc
index 762b6da6d79b895085d3a288b2eef52e796ce135..99f66caa903c2ab79d1895a7a62d36759b71996e 100644
--- a/webrtc/p2p/stunprober/main.cc
+++ b/webrtc/p2p/stunprober/main.cc
@@ -106,16 +106,19 @@ class HostNameResolver : public HostNameResolverInterface,
rtc::AsyncResolver* resolver_;
};
-std::string HistogramName(bool behind_nat,
- bool is_src_port_shared,
- int interval_ms,
- std::string suffix) {
- char output[1000];
- rtc::sprintfn(output, sizeof(output), "NetConnectivity6.%s.%s.%dms.%s",
- behind_nat ? "NAT" : "NoNAT",
- is_src_port_shared ? "SrcPortShared" : "SrcPortUnique",
- interval_ms, suffix.c_str());
- return std::string(output);
+const char* PrintNatType(stunprober::NatType type) {
+ switch (type) {
+ case stunprober::NATTYPE_NONE:
+ return "Not behind a NAT";
+ case stunprober::NATTYPE_UNKNOWN:
+ return "Unknown NAT type";
+ case stunprober::NATTYPE_SYMMETRIC:
+ return "Symmetric NAT";
+ case stunprober::NATTYPE_NON_SYMMETRIC:
+ return "Non-Symmetric NAT";
+ default:
+ return "Invalid";
+ }
}
void PrintStats(StunProber* prober) {
@@ -130,27 +133,15 @@ void PrintStats(StunProber* prober) {
LOG(LS_INFO) << "Responses received: " << stats.num_response_received;
LOG(LS_INFO) << "Target interval (ns): " << stats.target_request_interval_ns;
LOG(LS_INFO) << "Actual interval (ns): " << stats.actual_request_interval_ns;
- LOG(LS_INFO) << "Behind NAT: " << stats.behind_nat;
- if (stats.behind_nat) {
- LOG(LS_INFO) << "NAT is symmetrical: " << (stats.srflx_addrs.size() > 1);
- }
+ LOG(LS_INFO) << "NAT Type: " << PrintNatType(stats.nat_type);
LOG(LS_INFO) << "Host IP: " << stats.host_ip;
LOG(LS_INFO) << "Server-reflexive ips: ";
for (auto& ip : stats.srflx_addrs) {
LOG(LS_INFO) << "\t" << ip;
}
- std::string histogram_name = HistogramName(
- stats.behind_nat, FLAG_shared_socket, FLAG_interval, "SuccessPercent");
-
- LOG(LS_INFO) << "Histogram '" << histogram_name.c_str()
- << "' = " << stats.success_percent;
-
- histogram_name = HistogramName(stats.behind_nat, FLAG_shared_socket,
- FLAG_interval, "ResponseLatency");
-
- LOG(LS_INFO) << "Histogram '" << histogram_name.c_str()
- << "' = " << stats.average_rtt_ms << " ms";
+ LOG(LS_INFO) << "Success Precent: " << stats.success_percent;
+ LOG(LS_INFO) << "Response Latency:" << stats.average_rtt_ms;
}
void StopTrial(rtc::Thread* thread, StunProber* prober, int result) {
« no previous file with comments | « no previous file | webrtc/p2p/stunprober/stunprober.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698