diff options
author | mef@chromium.org <mef@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-29 21:06:09 +0000 |
---|---|---|
committer | mef@chromium.org <mef@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-29 21:06:09 +0000 |
commit | d1caf715b7a2714a5df18544c8f11d25633fe315 (patch) | |
tree | 9124c33f6d47cf1563ec3ebadfe19733024c8a91 /net/dns/dns_transaction.cc | |
parent | 6d3bc6abf37a320cd9311c5717499225bcd9379b (diff) | |
download | chromium_src-d1caf715b7a2714a5df18544c8f11d25633fe315.zip chromium_src-d1caf715b7a2714a5df18544c8f11d25633fe315.tar.gz chromium_src-d1caf715b7a2714a5df18544c8f11d25633fe315.tar.bz2 |
DnsTransaction::RecordLostPacketsIfAny shouldn't crash if some attempts failed to connect and thus have NULL socket_lease.
BUG=244507
TEST=net_unittests --gtest_filter=DnsTransactionTest.ConnectFailureFollowedBySuccess
Review URL: https://chromiumcodereview.appspot.com/15881008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202967 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/dns/dns_transaction.cc')
-rw-r--r-- | net/dns/dns_transaction.cc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/net/dns/dns_transaction.cc b/net/dns/dns_transaction.cc index a6a5741..e13f118 100644 --- a/net/dns/dns_transaction.cc +++ b/net/dns/dns_transaction.cc @@ -802,14 +802,16 @@ class DnsTransactionImpl : public DnsTransaction, if (first_completed == attempts_.size()) return; - std::vector<int> num_rounds(session_->config().nameservers.size()); + size_t num_servers = session_->config().nameservers.size(); for (size_t i = 0; i < first_completed; ++i) { - unsigned server_index = attempts_[i]->GetServerIndex(); - int server_round = num_rounds[server_index]++; // Don't record lost packet unless attempt is in pending state. if (!attempts_[i]->is_pending()) continue; - session_->RecordLostPacket(server_index, server_round); + unsigned server_index = attempts_[i]->GetServerIndex(); + // Servers are rotated in round robin, so server round can be calculated + // from attempt index. + size_t server_round = i / num_servers; + session_->RecordLostPacket(server_index, static_cast<int>(server_round)); } } |