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

Unified Diff: net/quic/quic_stream_factory.cc

Issue 1866613002: QUIC - Android - Fix the bug in QuicServerInfoMap iteration when server (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comments for PatchSet 1 Created 4 years, 8 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 | net/quic/quic_stream_factory_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_stream_factory.cc
diff --git a/net/quic/quic_stream_factory.cc b/net/quic/quic_stream_factory.cc
index 20335a57be31b28ccb862869b72a4a6259c74844..3a4d135151a45013e073ef492cda54e830379c0e 100644
--- a/net/quic/quic_stream_factory.cc
+++ b/net/quic/quic_stream_factory.cc
@@ -65,6 +65,7 @@
#endif
using std::min;
+using std::vector;
using NetworkHandle = net::NetworkChangeNotifier::NetworkHandle;
namespace net {
@@ -1712,12 +1713,18 @@ void QuicStreamFactory::MaybeInitialize() {
if (http_server_properties_->max_server_configs_stored_in_properties() == 0)
return;
// Create a temporary QuicServerInfo object to deserialize and to populate the
- // in-memory crypto server config cache.
+ // in-memory crypto server config cache in the MRU order.
scoped_ptr<QuicServerInfo> server_info;
CompletionCallback callback;
- for (const auto& key_value :
- http_server_properties_->quic_server_info_map()) {
- const QuicServerId& server_id = key_value.first;
+ // Get the list of servers to be deserialized first because WaitForDataReady
+ // touches quic_server_info_map.
+ const QuicServerInfoMap& quic_server_info_map =
+ http_server_properties_->quic_server_info_map();
+ vector<QuicServerId> server_list(quic_server_info_map.size());
+ for (const auto& key_value : quic_server_info_map)
+ server_list.push_back(key_value.first);
+ for (auto it = server_list.rbegin(); it != server_list.rend(); ++it) {
+ const QuicServerId& server_id = *it;
server_info.reset(quic_server_info_factory_->GetForServer(server_id));
if (server_info->WaitForDataReady(callback) == OK) {
DVLOG(1) << "Initialized server config for: " << server_id.ToString();
« no previous file with comments | « no previous file | net/quic/quic_stream_factory_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698