| 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 "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 new QueuedPacket(server_address, client_address, packet->Clone()); | 183 new QueuedPacket(server_address, client_address, packet->Clone()); |
| 184 // Takes ownership of the packet. | 184 // Takes ownership of the packet. |
| 185 SendOrQueuePacket(queued_packet); | 185 SendOrQueuePacket(queued_packet); |
| 186 } | 186 } |
| 187 return; | 187 return; |
| 188 } | 188 } |
| 189 | 189 |
| 190 SendPublicReset(server_address, client_address, connection_id, packet_number); | 190 SendPublicReset(server_address, client_address, connection_id, packet_number); |
| 191 } | 191 } |
| 192 | 192 |
| 193 void QuicTimeWaitListManager::SendVersionNegotiationPacket( |
| 194 QuicConnectionId connection_id, |
| 195 const QuicVersionVector& supported_versions, |
| 196 const IPEndPoint& server_address, |
| 197 const IPEndPoint& client_address) { |
| 198 QueuedPacket* packet = new QueuedPacket( |
| 199 server_address, client_address, QuicFramer::BuildVersionNegotiationPacket( |
| 200 connection_id, supported_versions)); |
| 201 SendOrQueuePacket(packet); |
| 202 } |
| 203 |
| 193 // Returns true if the number of packets received for this connection_id is a | 204 // Returns true if the number of packets received for this connection_id is a |
| 194 // power of 2 to throttle the number of public reset packets we send to a | 205 // power of 2 to throttle the number of public reset packets we send to a |
| 195 // client. | 206 // client. |
| 196 bool QuicTimeWaitListManager::ShouldSendResponse(int received_packet_count) { | 207 bool QuicTimeWaitListManager::ShouldSendResponse(int received_packet_count) { |
| 197 return (received_packet_count & (received_packet_count - 1)) == 0; | 208 return (received_packet_count & (received_packet_count - 1)) == 0; |
| 198 } | 209 } |
| 199 | 210 |
| 200 void QuicTimeWaitListManager::SendPublicReset( | 211 void QuicTimeWaitListManager::SendPublicReset( |
| 201 const IPEndPoint& server_address, | 212 const IPEndPoint& server_address, |
| 202 const IPEndPoint& client_address, | 213 const IPEndPoint& client_address, |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 version(version_), | 335 version(version_), |
| 325 time_added(time_added_), | 336 time_added(time_added_), |
| 326 connection_rejected_statelessly(connection_rejected_statelessly) {} | 337 connection_rejected_statelessly(connection_rejected_statelessly) {} |
| 327 | 338 |
| 328 QuicTimeWaitListManager::ConnectionIdData::ConnectionIdData( | 339 QuicTimeWaitListManager::ConnectionIdData::ConnectionIdData( |
| 329 const ConnectionIdData& other) = default; | 340 const ConnectionIdData& other) = default; |
| 330 | 341 |
| 331 QuicTimeWaitListManager::ConnectionIdData::~ConnectionIdData() {} | 342 QuicTimeWaitListManager::ConnectionIdData::~ConnectionIdData() {} |
| 332 | 343 |
| 333 } // namespace net | 344 } // namespace net |
| OLD | NEW |