| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // Handles packets for connection_ids in time wait state by discarding the | 5 // Handles packets for connection_ids in time wait state by discarding the |
| 6 // packet and sending the clients a public reset packet with exponential | 6 // packet and sending the clients a public reset packet with exponential |
| 7 // backoff. | 7 // backoff. |
| 8 | 8 |
| 9 #ifndef NET_QUIC_QUIC_TIME_WAIT_LIST_MANAGER_H_ | 9 #ifndef NET_QUIC_QUIC_TIME_WAIT_LIST_MANAGER_H_ |
| 10 #define NET_QUIC_QUIC_TIME_WAIT_LIST_MANAGER_H_ | 10 #define NET_QUIC_QUIC_TIME_WAIT_LIST_MANAGER_H_ |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 // connection_id. | 41 // connection_id. |
| 42 class QuicTimeWaitListManager : public QuicBlockedWriterInterface { | 42 class QuicTimeWaitListManager : public QuicBlockedWriterInterface { |
| 43 public: | 43 public: |
| 44 // writer - the entity that writes to the socket. (Owned by the dispatcher) | 44 // writer - the entity that writes to the socket. (Owned by the dispatcher) |
| 45 // visitor - the entity that manages blocked writers. (The dispatcher) | 45 // visitor - the entity that manages blocked writers. (The dispatcher) |
| 46 // helper - used to run clean up alarms. (Owned by the owner of the server) | 46 // helper - used to run clean up alarms. (Owned by the owner of the server) |
| 47 QuicTimeWaitListManager(QuicPacketWriter* writer, | 47 QuicTimeWaitListManager(QuicPacketWriter* writer, |
| 48 QuicServerSessionVisitor* visitor, | 48 QuicServerSessionVisitor* visitor, |
| 49 QuicConnectionHelperInterface* helper, | 49 QuicConnectionHelperInterface* helper, |
| 50 const QuicVersionVector& supported_versions); | 50 const QuicVersionVector& supported_versions); |
| 51 virtual ~QuicTimeWaitListManager(); | 51 ~QuicTimeWaitListManager() override; |
| 52 | 52 |
| 53 // Adds the given connection_id to time wait state for kTimeWaitPeriod. | 53 // Adds the given connection_id to time wait state for kTimeWaitPeriod. |
| 54 // Henceforth, any packet bearing this connection_id should not be processed | 54 // Henceforth, any packet bearing this connection_id should not be processed |
| 55 // while the connection_id remains in this list. If a non-nullptr | 55 // while the connection_id remains in this list. If a non-nullptr |
| 56 // |close_packet| is provided, it is sent again when packets are received for | 56 // |close_packet| is provided, it is sent again when packets are received for |
| 57 // added connection_ids. If nullptr, a public reset packet is sent with the | 57 // added connection_ids. If nullptr, a public reset packet is sent with the |
| 58 // specified |version|. DCHECKs that connection_id is not already on the list. | 58 // specified |version|. DCHECKs that connection_id is not already on the list. |
| 59 void AddConnectionIdToTimeWait(QuicConnectionId connection_id, | 59 void AddConnectionIdToTimeWait(QuicConnectionId connection_id, |
| 60 QuicVersion version, | 60 QuicVersion version, |
| 61 QuicEncryptedPacket* close_packet); // Owned. | 61 QuicEncryptedPacket* close_packet); // Owned. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 72 // state. virtual to override in tests. | 72 // state. virtual to override in tests. |
| 73 virtual void ProcessPacket(const IPEndPoint& server_address, | 73 virtual void ProcessPacket(const IPEndPoint& server_address, |
| 74 const IPEndPoint& client_address, | 74 const IPEndPoint& client_address, |
| 75 QuicConnectionId connection_id, | 75 QuicConnectionId connection_id, |
| 76 QuicPacketSequenceNumber sequence_number, | 76 QuicPacketSequenceNumber sequence_number, |
| 77 const QuicEncryptedPacket& packet); | 77 const QuicEncryptedPacket& packet); |
| 78 | 78 |
| 79 // Called by the dispatcher when the underlying socket becomes writable again, | 79 // Called by the dispatcher when the underlying socket becomes writable again, |
| 80 // since we might need to send pending public reset packets which we didn't | 80 // since we might need to send pending public reset packets which we didn't |
| 81 // send because the underlying socket was write blocked. | 81 // send because the underlying socket was write blocked. |
| 82 virtual void OnCanWrite() override; | 82 void OnCanWrite() override; |
| 83 | 83 |
| 84 // Used to delete connection_id entries that have outlived their time wait | 84 // Used to delete connection_id entries that have outlived their time wait |
| 85 // period. | 85 // period. |
| 86 void CleanUpOldConnectionIds(); | 86 void CleanUpOldConnectionIds(); |
| 87 | 87 |
| 88 // Given a ConnectionId that exists in the time wait list, returns the | 88 // Given a ConnectionId that exists in the time wait list, returns the |
| 89 // QuicVersion associated with it. | 89 // QuicVersion associated with it. |
| 90 QuicVersion GetQuicVersionFromConnectionId(QuicConnectionId connection_id); | 90 QuicVersion GetQuicVersionFromConnectionId(QuicConnectionId connection_id); |
| 91 | 91 |
| 92 protected: | 92 protected: |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 | 165 |
| 166 // Interface that manages blocked writers. | 166 // Interface that manages blocked writers. |
| 167 QuicServerSessionVisitor* visitor_; | 167 QuicServerSessionVisitor* visitor_; |
| 168 | 168 |
| 169 DISALLOW_COPY_AND_ASSIGN(QuicTimeWaitListManager); | 169 DISALLOW_COPY_AND_ASSIGN(QuicTimeWaitListManager); |
| 170 }; | 170 }; |
| 171 | 171 |
| 172 } // namespace net | 172 } // namespace net |
| 173 | 173 |
| 174 #endif // NET_QUIC_QUIC_TIME_WAIT_LIST_MANAGER_H_ | 174 #endif // NET_QUIC_QUIC_TIME_WAIT_LIST_MANAGER_H_ |
| OLD | NEW |