| 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/tools/quic/quic_time_wait_list_manager.h" | 5 #include "net/tools/quic/quic_time_wait_list_manager.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/stl_util.h" | |
| 13 #include "net/quic/core/crypto/crypto_protocol.h" | 12 #include "net/quic/core/crypto/crypto_protocol.h" |
| 14 #include "net/quic/core/crypto/quic_decrypter.h" | 13 #include "net/quic/core/crypto/quic_decrypter.h" |
| 15 #include "net/quic/core/crypto/quic_encrypter.h" | 14 #include "net/quic/core/crypto/quic_encrypter.h" |
| 16 #include "net/quic/core/quic_flags.h" | 15 #include "net/quic/core/quic_flags.h" |
| 17 #include "net/quic/core/quic_framer.h" | 16 #include "net/quic/core/quic_framer.h" |
| 18 #include "net/quic/core/quic_packets.h" | 17 #include "net/quic/core/quic_packets.h" |
| 19 #include "net/quic/core/quic_server_session_base.h" | 18 #include "net/quic/core/quic_server_session_base.h" |
| 20 #include "net/quic/core/quic_utils.h" | 19 #include "net/quic/core/quic_utils.h" |
| 21 #include "net/quic/platform/api/quic_clock.h" | 20 #include "net/quic/platform/api/quic_clock.h" |
| 22 #include "net/quic/platform/api/quic_logging.h" | 21 #include "net/quic/platform/api/quic_logging.h" |
| 22 #include "net/quic/platform/api/quic_map_util.h" |
| 23 #include "net/quic/platform/api/quic_ptr_util.h" | 23 #include "net/quic/platform/api/quic_ptr_util.h" |
| 24 #include "net/quic/platform/api/quic_socket_address.h" | 24 #include "net/quic/platform/api/quic_socket_address.h" |
| 25 | 25 |
| 26 using base::StringPiece; | 26 using base::StringPiece; |
| 27 | 27 |
| 28 namespace net { | 28 namespace net { |
| 29 | 29 |
| 30 // A very simple alarm that just informs the QuicTimeWaitListManager to clean | 30 // A very simple alarm that just informs the QuicTimeWaitListManager to clean |
| 31 // up old connection_ids. This alarm should be cancelled and deleted before | 31 // up old connection_ids. This alarm should be cancelled and deleted before |
| 32 // the QuicTimeWaitListManager is deleted. | 32 // the QuicTimeWaitListManager is deleted. |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 data.termination_packets.swap(*termination_packets); | 120 data.termination_packets.swap(*termination_packets); |
| 121 } | 121 } |
| 122 connection_id_map_.emplace(std::make_pair(connection_id, std::move(data))); | 122 connection_id_map_.emplace(std::make_pair(connection_id, std::move(data))); |
| 123 if (new_connection_id) { | 123 if (new_connection_id) { |
| 124 visitor_->OnConnectionAddedToTimeWaitList(connection_id); | 124 visitor_->OnConnectionAddedToTimeWaitList(connection_id); |
| 125 } | 125 } |
| 126 } | 126 } |
| 127 | 127 |
| 128 bool QuicTimeWaitListManager::IsConnectionIdInTimeWait( | 128 bool QuicTimeWaitListManager::IsConnectionIdInTimeWait( |
| 129 QuicConnectionId connection_id) const { | 129 QuicConnectionId connection_id) const { |
| 130 return base::ContainsKey(connection_id_map_, connection_id); | 130 return QuicContainsKey(connection_id_map_, connection_id); |
| 131 } | 131 } |
| 132 | 132 |
| 133 QuicVersion QuicTimeWaitListManager::GetQuicVersionFromConnectionId( | 133 QuicVersion QuicTimeWaitListManager::GetQuicVersionFromConnectionId( |
| 134 QuicConnectionId connection_id) { | 134 QuicConnectionId connection_id) { |
| 135 ConnectionIdMap::iterator it = connection_id_map_.find(connection_id); | 135 ConnectionIdMap::iterator it = connection_id_map_.find(connection_id); |
| 136 DCHECK(it != connection_id_map_.end()); | 136 DCHECK(it != connection_id_map_.end()); |
| 137 return (it->second).version; | 137 return (it->second).version; |
| 138 } | 138 } |
| 139 | 139 |
| 140 void QuicTimeWaitListManager::OnCanWrite() { | 140 void QuicTimeWaitListManager::OnCanWrite() { |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 version(version_), | 323 version(version_), |
| 324 time_added(time_added_), | 324 time_added(time_added_), |
| 325 connection_rejected_statelessly(connection_rejected_statelessly) {} | 325 connection_rejected_statelessly(connection_rejected_statelessly) {} |
| 326 | 326 |
| 327 QuicTimeWaitListManager::ConnectionIdData::ConnectionIdData( | 327 QuicTimeWaitListManager::ConnectionIdData::ConnectionIdData( |
| 328 ConnectionIdData&& other) = default; | 328 ConnectionIdData&& other) = default; |
| 329 | 329 |
| 330 QuicTimeWaitListManager::ConnectionIdData::~ConnectionIdData() {} | 330 QuicTimeWaitListManager::ConnectionIdData::~ConnectionIdData() {} |
| 331 | 331 |
| 332 } // namespace net | 332 } // namespace net |
| OLD | NEW |