OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/quic/quic_stream_factory.h" | 5 #include "net/quic/quic_stream_factory.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 1694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1705 if (alternative_service_info.alternative_service.protocol == QUIC) { | 1705 if (alternative_service_info.alternative_service.protocol == QUIC) { |
1706 quic_supported_servers_at_startup_.insert(key_value.first); | 1706 quic_supported_servers_at_startup_.insert(key_value.first); |
1707 break; | 1707 break; |
1708 } | 1708 } |
1709 } | 1709 } |
1710 } | 1710 } |
1711 | 1711 |
1712 if (http_server_properties_->max_server_configs_stored_in_properties() == 0) | 1712 if (http_server_properties_->max_server_configs_stored_in_properties() == 0) |
1713 return; | 1713 return; |
1714 // Create a temporary QuicServerInfo object to deserialize and to populate the | 1714 // Create a temporary QuicServerInfo object to deserialize and to populate the |
1715 // in-memory crypto server config cache. | 1715 // in-memory crypto server config cache in the MRU order. |
1716 scoped_ptr<QuicServerInfo> server_info; | 1716 scoped_ptr<QuicServerInfo> server_info; |
1717 CompletionCallback callback; | 1717 CompletionCallback callback; |
1718 for (const auto& key_value : | 1718 // Get the list of servers to be deserialized first because WaitForDataReady |
1719 http_server_properties_->quic_server_info_map()) { | 1719 // touches quic_server_info_map. |
1720 const QuicServerId& server_id = key_value.first; | 1720 const QuicServerInfoMap& quic_server_info_map = |
1721 http_server_properties_->quic_server_info_map(); | |
1722 std::vector<QuicServerId> server_list(quic_server_info_map.size()); | |
1723 for (const auto& key_value : quic_server_info_map) | |
1724 server_list.insert(server_list.begin(), key_value.first); | |
Ryan Hamilton
2016/04/06 04:25:54
It looks like this is going to be O(n^2) since it
ramant (doing other things)
2016/04/06 04:56:07
facepalm (thanks for catching this). Used push_bac
| |
1725 for (QuicServerId server_id : server_list) { | |
1721 server_info.reset(quic_server_info_factory_->GetForServer(server_id)); | 1726 server_info.reset(quic_server_info_factory_->GetForServer(server_id)); |
1722 if (server_info->WaitForDataReady(callback) == OK) { | 1727 if (server_info->WaitForDataReady(callback) == OK) { |
1723 DVLOG(1) << "Initialized server config for: " << server_id.ToString(); | 1728 DVLOG(1) << "Initialized server config for: " << server_id.ToString(); |
1724 InitializeCachedStateInCryptoConfig(server_id, server_info, nullptr); | 1729 InitializeCachedStateInCryptoConfig(server_id, server_info, nullptr); |
1725 } | 1730 } |
1726 } | 1731 } |
1727 } | 1732 } |
1728 | 1733 |
1729 void QuicStreamFactory::ProcessGoingAwaySession( | 1734 void QuicStreamFactory::ProcessGoingAwaySession( |
1730 QuicChromiumClientSession* session, | 1735 QuicChromiumClientSession* session, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1762 // Since the session was active, there's no longer an | 1767 // Since the session was active, there's no longer an |
1763 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP | 1768 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP |
1764 // job also fails. So to avoid not using QUIC when we otherwise could, we mark | 1769 // job also fails. So to avoid not using QUIC when we otherwise could, we mark |
1765 // it as recently broken, which means that 0-RTT will be disabled but we'll | 1770 // it as recently broken, which means that 0-RTT will be disabled but we'll |
1766 // still race. | 1771 // still race. |
1767 http_server_properties_->MarkAlternativeServiceRecentlyBroken( | 1772 http_server_properties_->MarkAlternativeServiceRecentlyBroken( |
1768 alternative_service); | 1773 alternative_service); |
1769 } | 1774 } |
1770 | 1775 |
1771 } // namespace net | 1776 } // namespace net |
OLD | NEW |