| 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/test_tools/quic_connection_peer.h" | 5 #include "net/quic/test_tools/quic_connection_peer.h" |
| 6 | 6 |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "net/quic/congestion_control/send_algorithm_interface.h" | 8 #include "net/quic/congestion_control/send_algorithm_interface.h" |
| 9 #include "net/quic/quic_connection.h" | 9 #include "net/quic/quic_connection.h" |
| 10 #include "net/quic/quic_packet_writer.h" | 10 #include "net/quic/quic_packet_writer.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 return &connection->sent_packet_manager_; | 66 return &connection->sent_packet_manager_; |
| 67 } | 67 } |
| 68 | 68 |
| 69 // static | 69 // static |
| 70 QuicTime::Delta QuicConnectionPeer::GetNetworkTimeout( | 70 QuicTime::Delta QuicConnectionPeer::GetNetworkTimeout( |
| 71 QuicConnection* connection) { | 71 QuicConnection* connection) { |
| 72 return connection->idle_network_timeout_; | 72 return connection->idle_network_timeout_; |
| 73 } | 73 } |
| 74 | 74 |
| 75 // static | 75 // static |
| 76 QuicSentEntropyManager* QuicConnectionPeer::GetSentEntropyManager( |
| 77 QuicConnection* connection) { |
| 78 return &connection->sent_entropy_manager_; |
| 79 } |
| 80 |
| 81 // static |
| 76 // TODO(ianswett): Create a GetSentEntropyHash which accepts an AckFrame. | 82 // TODO(ianswett): Create a GetSentEntropyHash which accepts an AckFrame. |
| 77 QuicPacketEntropyHash QuicConnectionPeer::GetSentEntropyHash( | 83 QuicPacketEntropyHash QuicConnectionPeer::GetSentEntropyHash( |
| 78 QuicConnection* connection, | 84 QuicConnection* connection, |
| 79 QuicPacketNumber packet_number) { | 85 QuicPacketNumber packet_number) { |
| 80 QuicSentEntropyManager::CumulativeEntropy last_entropy_copy = | 86 QuicSentEntropyManager::CumulativeEntropy last_entropy_copy = |
| 81 connection->sent_entropy_manager_.last_cumulative_entropy_; | 87 connection->sent_entropy_manager_.last_cumulative_entropy_; |
| 82 connection->sent_entropy_manager_.UpdateCumulativeEntropy(packet_number, | 88 connection->sent_entropy_manager_.UpdateCumulativeEntropy(packet_number, |
| 83 &last_entropy_copy); | 89 &last_entropy_copy); |
| 84 return last_entropy_copy.entropy; | 90 return last_entropy_copy.entropy; |
| 85 } | 91 } |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 } | 212 } |
| 207 | 213 |
| 208 // static | 214 // static |
| 209 void QuicConnectionPeer::CloseConnection(QuicConnection* connection) { | 215 void QuicConnectionPeer::CloseConnection(QuicConnection* connection) { |
| 210 connection->connected_ = false; | 216 connection->connected_ = false; |
| 211 } | 217 } |
| 212 | 218 |
| 213 // static | 219 // static |
| 214 QuicEncryptedPacket* QuicConnectionPeer::GetConnectionClosePacket( | 220 QuicEncryptedPacket* QuicConnectionPeer::GetConnectionClosePacket( |
| 215 QuicConnection* connection) { | 221 QuicConnection* connection) { |
| 216 return connection->connection_close_packet_.get(); | 222 if (connection->termination_packets_ == nullptr || |
| 223 connection->termination_packets_->empty()) { |
| 224 return nullptr; |
| 225 } |
| 226 return (*connection->termination_packets_)[0]; |
| 217 } | 227 } |
| 218 | 228 |
| 219 // static | 229 // static |
| 220 QuicPacketHeader* QuicConnectionPeer::GetLastHeader( | 230 QuicPacketHeader* QuicConnectionPeer::GetLastHeader( |
| 221 QuicConnection* connection) { | 231 QuicConnection* connection) { |
| 222 return &connection->last_header_; | 232 return &connection->last_header_; |
| 223 } | 233 } |
| 224 | 234 |
| 225 // static | 235 // static |
| 226 void QuicConnectionPeer::SetPacketNumberOfLastSentPacket( | 236 void QuicConnectionPeer::SetPacketNumberOfLastSentPacket( |
| (...skipping 20 matching lines...) Expand all Loading... |
| 247 } | 257 } |
| 248 | 258 |
| 249 // static | 259 // static |
| 250 void QuicConnectionPeer::SetNextMtuProbeAt(QuicConnection* connection, | 260 void QuicConnectionPeer::SetNextMtuProbeAt(QuicConnection* connection, |
| 251 QuicPacketNumber number) { | 261 QuicPacketNumber number) { |
| 252 connection->next_mtu_probe_at_ = number; | 262 connection->next_mtu_probe_at_ = number; |
| 253 } | 263 } |
| 254 | 264 |
| 255 } // namespace test | 265 } // namespace test |
| 256 } // namespace net | 266 } // namespace net |
| OLD | NEW |