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

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

Issue 1406223011: Relax the stun ping check on valid result (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: fix a comment. Created 5 years, 1 month 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 | « webrtc/p2p/stunprober/stunprober.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/stunprober/stunprober.cc
diff --git a/webrtc/p2p/stunprober/stunprober.cc b/webrtc/p2p/stunprober/stunprober.cc
index ee9eb2258cf05c195a8b5cb4970262bbc063202a..9316ea89bd6d5735ba8d28a9ee1a15758b4a5a06 100644
--- a/webrtc/p2p/stunprober/stunprober.cc
+++ b/webrtc/p2p/stunprober/stunprober.cc
@@ -460,6 +460,7 @@ bool StunProber::GetStats(StunProber::Stats* prob_stats) const {
continue;
}
+ ++stats.raw_num_request_sent;
IncrementCounterByAddress(&num_request_per_server, request->server_addr);
if (!first_sent_time) {
@@ -503,11 +504,6 @@ bool StunProber::GetStats(StunProber::Stats* prob_stats) const {
num_sent += num_request_per_server[kv.first];
}
- // Not receiving any response, the trial is inconclusive.
- if (!num_received) {
- return false;
- }
-
// Shared mode is only true if we use the shared socket and there are more
// than 1 responding servers.
stats.shared_socket_mode =
@@ -519,7 +515,8 @@ bool StunProber::GetStats(StunProber::Stats* prob_stats) const {
// If we could find a local IP matching srflx, we're not behind a NAT.
rtc::SocketAddress srflx_addr;
- if (!srflx_addr.FromString(*(stats.srflx_addrs.begin()))) {
+ if (stats.srflx_addrs.size() &&
+ !srflx_addr.FromString(*(stats.srflx_addrs.begin()))) {
return false;
}
for (const auto& net : networks_) {
@@ -544,9 +541,10 @@ bool StunProber::GetStats(StunProber::Stats* prob_stats) const {
stats.success_percent = static_cast<int>(100 * num_received / num_sent);
}
- if (num_sent > 1) {
+ if (stats.raw_num_request_sent > 1) {
stats.actual_request_interval_ns =
- (1000 * (last_sent_time - first_sent_time)) / (num_sent - 1);
+ (1000 * (last_sent_time - first_sent_time)) /
+ (stats.raw_num_request_sent - 1);
}
if (num_received) {
« no previous file with comments | « webrtc/p2p/stunprober/stunprober.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698