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 // Handles packets for guids in time wait state by discarding the packet and | 5 // Handles packets for guids in time wait state by discarding the packet and |
6 // sending the clients a public reset packet with exponential backoff. | 6 // sending the clients a public reset packet with exponential backoff. |
7 | 7 |
8 #ifndef NET_TOOLS_QUIC_QUIC_TIME_WAIT_LIST_MANAGER_H_ | 8 #ifndef NET_TOOLS_QUIC_QUIC_TIME_WAIT_LIST_MANAGER_H_ |
9 #define NET_TOOLS_QUIC_QUIC_TIME_WAIT_LIST_MANAGER_H_ | 9 #define NET_TOOLS_QUIC_QUIC_TIME_WAIT_LIST_MANAGER_H_ |
10 | 10 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // Creates a public reset packet and sends it or queues it to be sent later. | 96 // Creates a public reset packet and sends it or queues it to be sent later. |
97 void SendPublicReset(const IPEndPoint& server_address, | 97 void SendPublicReset(const IPEndPoint& server_address, |
98 const IPEndPoint& client_address, | 98 const IPEndPoint& client_address, |
99 QuicGuid guid, | 99 QuicGuid guid, |
100 QuicPacketSequenceNumber rejected_sequence_number); | 100 QuicPacketSequenceNumber rejected_sequence_number); |
101 | 101 |
102 // Either sends the packet and deletes it or makes pending_packets_queue_ the | 102 // Either sends the packet and deletes it or makes pending_packets_queue_ the |
103 // owner of the packet. | 103 // owner of the packet. |
104 void SendOrQueuePacket(QueuedPacket* packet); | 104 void SendOrQueuePacket(QueuedPacket* packet); |
105 | 105 |
106 // Should only be called when write_blocked_ == false. We only care if the | 106 // Sends the packet out. Returns true if the packet was successfully consumed. |
107 // writing was unsuccessful because the socket got blocked, which can be | 107 // If the writer got blocked and did not buffer the packet, we'll need to keep |
108 // tested using write_blocked_ == true. In case of all other errors we drop | 108 // the packet and retry sending. In case of all other errors we drop the |
109 // the packet. Hence, we return void. | 109 // packet. |
110 void WriteToWire(QueuedPacket* packet); | 110 bool WriteToWire(QueuedPacket* packet); |
111 | 111 |
112 // Register the alarm with the epoll server to wake up at appropriate time. | 112 // Register the alarm with the epoll server to wake up at appropriate time. |
113 void SetGuidCleanUpAlarm(); | 113 void SetGuidCleanUpAlarm(); |
114 | 114 |
115 // A map from a recently closed guid to the number of packets received after | 115 // A map from a recently closed guid to the number of packets received after |
116 // the termination of the connection bound to the guid. | 116 // the termination of the connection bound to the guid. |
117 struct GuidData { | 117 struct GuidData { |
118 GuidData(int num_packets_, | 118 GuidData(int num_packets_, |
119 QuicVersion version_, | 119 QuicVersion version_, |
120 QuicEncryptedPacket* close_packet) | 120 QuicEncryptedPacket* close_packet) |
(...skipping 25 matching lines...) Expand all Loading... |
146 // Alarm registered with the epoll server to clean up guids that have out | 146 // Alarm registered with the epoll server to clean up guids that have out |
147 // lived their duration in time wait state. | 147 // lived their duration in time wait state. |
148 scoped_ptr<GuidCleanUpAlarm> guid_clean_up_alarm_; | 148 scoped_ptr<GuidCleanUpAlarm> guid_clean_up_alarm_; |
149 | 149 |
150 // Clock to efficiently measure approximate time from the epoll server. | 150 // Clock to efficiently measure approximate time from the epoll server. |
151 QuicEpollClock clock_; | 151 QuicEpollClock clock_; |
152 | 152 |
153 // Interface that writes given buffer to the socket. Owned by the dispatcher. | 153 // Interface that writes given buffer to the socket. Owned by the dispatcher. |
154 QuicPacketWriter* writer_; | 154 QuicPacketWriter* writer_; |
155 | 155 |
156 // True if the underlying udp socket is write blocked, i.e will return EAGAIN | |
157 // on sendmsg. | |
158 bool is_write_blocked_; | |
159 | |
160 DISALLOW_COPY_AND_ASSIGN(QuicTimeWaitListManager); | 156 DISALLOW_COPY_AND_ASSIGN(QuicTimeWaitListManager); |
161 }; | 157 }; |
162 | 158 |
163 } // namespace tools | 159 } // namespace tools |
164 } // namespace net | 160 } // namespace net |
165 | 161 |
166 #endif // NET_TOOLS_QUIC_QUIC_TIME_WAIT_LIST_MANAGER_H_ | 162 #endif // NET_TOOLS_QUIC_QUIC_TIME_WAIT_LIST_MANAGER_H_ |
OLD | NEW |