Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(634)

Side by Side Diff: net/tools/quic/quic_time_wait_list_manager.cc

Issue 2846013002: Remove unused packet_number parameter from multiple functions in QUIC. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 return; 141 return;
142 } 142 }
143 pending_packets_queue_.pop_front(); 143 pending_packets_queue_.pop_front();
144 } 144 }
145 } 145 }
146 146
147 void QuicTimeWaitListManager::ProcessPacket( 147 void QuicTimeWaitListManager::ProcessPacket(
148 const QuicSocketAddress& server_address, 148 const QuicSocketAddress& server_address,
149 const QuicSocketAddress& client_address, 149 const QuicSocketAddress& client_address,
150 QuicConnectionId connection_id, 150 QuicConnectionId connection_id,
151 QuicPacketNumber packet_number,
152 const QuicEncryptedPacket& /*packet*/) { 151 const QuicEncryptedPacket& /*packet*/) {
153 DCHECK(IsConnectionIdInTimeWait(connection_id)); 152 DCHECK(IsConnectionIdInTimeWait(connection_id));
154 QUIC_DLOG(INFO) << "Processing " << connection_id << " in time wait state."; 153 QUIC_DLOG(INFO) << "Processing " << connection_id << " in time wait state.";
155 // TODO(satyamshekhar): Think about handling packets from different client 154 // TODO(satyamshekhar): Think about handling packets from different client
156 // addresses. 155 // addresses.
157 ConnectionIdMap::iterator it = connection_id_map_.find(connection_id); 156 ConnectionIdMap::iterator it = connection_id_map_.find(connection_id);
158 DCHECK(it != connection_id_map_.end()); 157 DCHECK(it != connection_id_map_.end());
159 // Increment the received packet count. 158 // Increment the received packet count.
160 ConnectionIdData* connection_data = &it->second; 159 ConnectionIdData* connection_data = &it->second;
161 ++(connection_data->num_packets); 160 ++(connection_data->num_packets);
162 161
163 if (!ShouldSendResponse(connection_data->num_packets)) { 162 if (!ShouldSendResponse(connection_data->num_packets)) {
164 return; 163 return;
165 } 164 }
166 165
167 if (!connection_data->termination_packets.empty()) { 166 if (!connection_data->termination_packets.empty()) {
168 if (connection_data->connection_rejected_statelessly) { 167 if (connection_data->connection_rejected_statelessly) {
169 QUIC_DVLOG(3) 168 QUIC_DVLOG(3)
170 << "Time wait list sending previous stateless reject response " 169 << "Time wait list sending previous stateless reject response "
171 << "for connection " << connection_id; 170 << "for connection " << connection_id;
172 } 171 }
173 for (const auto& packet : connection_data->termination_packets) { 172 for (const auto& packet : connection_data->termination_packets) {
174 SendOrQueuePacket(QuicMakeUnique<QueuedPacket>( 173 SendOrQueuePacket(QuicMakeUnique<QueuedPacket>(
175 server_address, client_address, packet->Clone())); 174 server_address, client_address, packet->Clone()));
176 } 175 }
177 return; 176 return;
178 } 177 }
179 178
180 SendPublicReset(server_address, client_address, connection_id, packet_number); 179 SendPublicReset(server_address, client_address, connection_id);
181 } 180 }
182 181
183 void QuicTimeWaitListManager::SendVersionNegotiationPacket( 182 void QuicTimeWaitListManager::SendVersionNegotiationPacket(
184 QuicConnectionId connection_id, 183 QuicConnectionId connection_id,
185 const QuicVersionVector& supported_versions, 184 const QuicVersionVector& supported_versions,
186 const QuicSocketAddress& server_address, 185 const QuicSocketAddress& server_address,
187 const QuicSocketAddress& client_address) { 186 const QuicSocketAddress& client_address) {
188 SendOrQueuePacket(QuicMakeUnique<QueuedPacket>( 187 SendOrQueuePacket(QuicMakeUnique<QueuedPacket>(
189 server_address, client_address, QuicFramer::BuildVersionNegotiationPacket( 188 server_address, client_address, QuicFramer::BuildVersionNegotiationPacket(
190 connection_id, supported_versions))); 189 connection_id, supported_versions)));
191 } 190 }
192 191
193 // Returns true if the number of packets received for this connection_id is a 192 // 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 193 // power of 2 to throttle the number of public reset packets we send to a
195 // client. 194 // client.
196 bool QuicTimeWaitListManager::ShouldSendResponse(int received_packet_count) { 195 bool QuicTimeWaitListManager::ShouldSendResponse(int received_packet_count) {
197 return (received_packet_count & (received_packet_count - 1)) == 0; 196 return (received_packet_count & (received_packet_count - 1)) == 0;
198 } 197 }
199 198
200 void QuicTimeWaitListManager::SendPublicReset( 199 void QuicTimeWaitListManager::SendPublicReset(
201 const QuicSocketAddress& server_address, 200 const QuicSocketAddress& server_address,
202 const QuicSocketAddress& client_address, 201 const QuicSocketAddress& client_address,
203 QuicConnectionId connection_id, 202 QuicConnectionId connection_id) {
204 QuicPacketNumber rejected_packet_number) {
205 QuicPublicResetPacket packet; 203 QuicPublicResetPacket packet;
206 packet.public_header.connection_id = connection_id; 204 packet.public_header.connection_id = connection_id;
207 packet.public_header.reset_flag = true; 205 packet.public_header.reset_flag = true;
208 packet.public_header.version_flag = false; 206 packet.public_header.version_flag = false;
209 // TODO(satyamshekhar): generate a valid nonce for this connection_id. 207 // TODO(satyamshekhar): generate a valid nonce for this connection_id.
210 packet.nonce_proof = 1010101; 208 packet.nonce_proof = 1010101;
211 packet.client_address = client_address; 209 packet.client_address = client_address;
212 // Takes ownership of the packet. 210 // Takes ownership of the packet.
213 SendOrQueuePacket(QuicMakeUnique<QueuedPacket>(server_address, client_address, 211 SendOrQueuePacket(QuicMakeUnique<QueuedPacket>(server_address, client_address,
214 BuildPublicReset(packet))); 212 BuildPublicReset(packet)));
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 version(version_), 317 version(version_),
320 time_added(time_added_), 318 time_added(time_added_),
321 connection_rejected_statelessly(connection_rejected_statelessly) {} 319 connection_rejected_statelessly(connection_rejected_statelessly) {}
322 320
323 QuicTimeWaitListManager::ConnectionIdData::ConnectionIdData( 321 QuicTimeWaitListManager::ConnectionIdData::ConnectionIdData(
324 ConnectionIdData&& other) = default; 322 ConnectionIdData&& other) = default;
325 323
326 QuicTimeWaitListManager::ConnectionIdData::~ConnectionIdData() {} 324 QuicTimeWaitListManager::ConnectionIdData::~ConnectionIdData() {}
327 325
328 } // namespace net 326 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_time_wait_list_manager.h ('k') | net/tools/quic/quic_time_wait_list_manager_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698