| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/crypto/quic_crypto_server_config.h" | 5 #include "net/quic/crypto/quic_crypto_server_config.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 | 9 |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 it->second->primary_time = config->primary_time; | 445 it->second->primary_time = config->primary_time; |
| 446 it->second->priority = config->priority; | 446 it->second->priority = config->priority; |
| 447 new_configs.insert(*it); | 447 new_configs.insert(*it); |
| 448 } else { | 448 } else { |
| 449 VLOG(1) << "Adding scid: " << base::HexEncode( | 449 VLOG(1) << "Adding scid: " << base::HexEncode( |
| 450 config->id.data(), config->id.size()) | 450 config->id.data(), config->id.size()) |
| 451 << " orbit: " << base::HexEncode( | 451 << " orbit: " << base::HexEncode( |
| 452 reinterpret_cast<const char *>(config->orbit), kOrbitSize) | 452 reinterpret_cast<const char *>(config->orbit), kOrbitSize) |
| 453 << " primary_time " << config->primary_time.ToUNIXSeconds() | 453 << " primary_time " << config->primary_time.ToUNIXSeconds() |
| 454 << " priority " << config->priority; | 454 << " priority " << config->priority; |
| 455 new_configs.insert(make_pair(config->id, config)); | 455 new_configs.insert(std::make_pair(config->id, config)); |
| 456 } | 456 } |
| 457 } | 457 } |
| 458 | 458 |
| 459 configs_.swap(new_configs); | 459 configs_.swap(new_configs); |
| 460 SelectNewPrimaryConfig(now); | 460 SelectNewPrimaryConfig(now); |
| 461 DCHECK(primary_config_.get()); | 461 DCHECK(primary_config_.get()); |
| 462 DCHECK_EQ(configs_.find(primary_config_->id)->second, primary_config_); | 462 DCHECK_EQ(configs_.find(primary_config_->id)->second, primary_config_); |
| 463 } | 463 } |
| 464 | 464 |
| 465 return ok; | 465 return ok; |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 829 | 829 |
| 830 if (configs.empty()) { | 830 if (configs.empty()) { |
| 831 if (primary_config_.get()) { | 831 if (primary_config_.get()) { |
| 832 LOG(DFATAL) << "No valid QUIC server config. Keeping the current config."; | 832 LOG(DFATAL) << "No valid QUIC server config. Keeping the current config."; |
| 833 } else { | 833 } else { |
| 834 LOG(DFATAL) << "No valid QUIC server config."; | 834 LOG(DFATAL) << "No valid QUIC server config."; |
| 835 } | 835 } |
| 836 return; | 836 return; |
| 837 } | 837 } |
| 838 | 838 |
| 839 sort(configs.begin(), configs.end(), ConfigPrimaryTimeLessThan); | 839 std::sort(configs.begin(), configs.end(), ConfigPrimaryTimeLessThan); |
| 840 | 840 |
| 841 Config* best_candidate = configs[0].get(); | 841 Config* best_candidate = configs[0].get(); |
| 842 | 842 |
| 843 for (size_t i = 0; i < configs.size(); ++i) { | 843 for (size_t i = 0; i < configs.size(); ++i) { |
| 844 const scoped_refptr<Config> config(configs[i]); | 844 const scoped_refptr<Config> config(configs[i]); |
| 845 if (!config->primary_time.IsAfter(now)) { | 845 if (!config->primary_time.IsAfter(now)) { |
| 846 if (config->primary_time.IsAfter(best_candidate->primary_time)) { | 846 if (config->primary_time.IsAfter(best_candidate->primary_time)) { |
| 847 best_candidate = config.get(); | 847 best_candidate = config.get(); |
| 848 } | 848 } |
| 849 continue; | 849 continue; |
| (...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1691 QuicCryptoServerConfig::Config::Config() | 1691 QuicCryptoServerConfig::Config::Config() |
| 1692 : channel_id_enabled(false), | 1692 : channel_id_enabled(false), |
| 1693 is_primary(false), | 1693 is_primary(false), |
| 1694 primary_time(QuicWallTime::Zero()), | 1694 primary_time(QuicWallTime::Zero()), |
| 1695 priority(0), | 1695 priority(0), |
| 1696 source_address_token_boxer(nullptr) {} | 1696 source_address_token_boxer(nullptr) {} |
| 1697 | 1697 |
| 1698 QuicCryptoServerConfig::Config::~Config() { STLDeleteElements(&key_exchanges); } | 1698 QuicCryptoServerConfig::Config::~Config() { STLDeleteElements(&key_exchanges); } |
| 1699 | 1699 |
| 1700 } // namespace net | 1700 } // namespace net |
| OLD | NEW |