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

Side by Side Diff: net/quic/quic_connection.cc

Issue 411823002: Land Recent QUIC Changes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase TOT Created 6 years, 4 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
« no previous file with comments | « net/quic/quic_connection.h ('k') | net/quic/quic_connection_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/quic/quic_connection.h" 5 #include "net/quic/quic_connection.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 #include <sys/types.h> 8 #include <sys/types.h>
9 #include <algorithm> 9 #include <algorithm>
10 #include <iterator> 10 #include <iterator>
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 type(GetPacketType(packet.retransmittable_frames)), 184 type(GetPacketType(packet.retransmittable_frames)),
185 length(packet.packet->length()) { 185 length(packet.packet->length()) {
186 } 186 }
187 187
188 #define ENDPOINT (is_server_ ? "Server: " : " Client: ") 188 #define ENDPOINT (is_server_ ? "Server: " : " Client: ")
189 189
190 QuicConnection::QuicConnection(QuicConnectionId connection_id, 190 QuicConnection::QuicConnection(QuicConnectionId connection_id,
191 IPEndPoint address, 191 IPEndPoint address,
192 QuicConnectionHelperInterface* helper, 192 QuicConnectionHelperInterface* helper,
193 QuicPacketWriter* writer, 193 QuicPacketWriter* writer,
194 bool owns_writer,
194 bool is_server, 195 bool is_server,
195 const QuicVersionVector& supported_versions) 196 const QuicVersionVector& supported_versions)
196 : framer_(supported_versions, helper->GetClock()->ApproximateNow(), 197 : framer_(supported_versions, helper->GetClock()->ApproximateNow(),
197 is_server), 198 is_server),
198 helper_(helper), 199 helper_(helper),
199 writer_(writer), 200 writer_(writer),
201 owns_writer_(owns_writer),
200 encryption_level_(ENCRYPTION_NONE), 202 encryption_level_(ENCRYPTION_NONE),
201 clock_(helper->GetClock()), 203 clock_(helper->GetClock()),
202 random_generator_(helper->GetRandomGenerator()), 204 random_generator_(helper->GetRandomGenerator()),
203 connection_id_(connection_id), 205 connection_id_(connection_id),
204 peer_address_(address), 206 peer_address_(address),
205 migrating_peer_port_(0), 207 migrating_peer_port_(0),
206 last_packet_revived_(false), 208 last_packet_revived_(false),
207 last_size_(0), 209 last_size_(0),
208 last_decrypted_packet_level_(ENCRYPTION_NONE), 210 last_decrypted_packet_level_(ENCRYPTION_NONE),
209 largest_seen_packet_with_ack_(0), 211 largest_seen_packet_with_ack_(0),
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 DVLOG(1) << ENDPOINT << "Created connection with connection_id: " 245 DVLOG(1) << ENDPOINT << "Created connection with connection_id: "
244 << connection_id; 246 << connection_id;
245 timeout_alarm_->Set(clock_->ApproximateNow().Add(idle_network_timeout_)); 247 timeout_alarm_->Set(clock_->ApproximateNow().Add(idle_network_timeout_));
246 framer_.set_visitor(this); 248 framer_.set_visitor(this);
247 framer_.set_received_entropy_calculator(&received_packet_manager_); 249 framer_.set_received_entropy_calculator(&received_packet_manager_);
248 stats_.connection_creation_time = clock_->ApproximateNow(); 250 stats_.connection_creation_time = clock_->ApproximateNow();
249 sent_packet_manager_.set_network_change_visitor(&packet_generator_); 251 sent_packet_manager_.set_network_change_visitor(&packet_generator_);
250 } 252 }
251 253
252 QuicConnection::~QuicConnection() { 254 QuicConnection::~QuicConnection() {
255 if (owns_writer_) {
256 delete writer_;
257 }
253 STLDeleteElements(&undecryptable_packets_); 258 STLDeleteElements(&undecryptable_packets_);
254 STLDeleteValues(&group_map_); 259 STLDeleteValues(&group_map_);
255 for (QueuedPacketList::iterator it = queued_packets_.begin(); 260 for (QueuedPacketList::iterator it = queued_packets_.begin();
256 it != queued_packets_.end(); ++it) { 261 it != queued_packets_.end(); ++it) {
257 delete it->packet; 262 delete it->packet;
258 } 263 }
259 } 264 }
260 265
261 void QuicConnection::SetFromConfig(const QuicConfig& config) { 266 void QuicConnection::SetFromConfig(const QuicConfig& config) {
262 SetIdleNetworkTimeout(config.idle_connection_state_lifetime()); 267 SetIdleNetworkTimeout(config.idle_connection_state_lifetime());
(...skipping 1719 matching lines...) Expand 10 before | Expand all | Expand 10 after
1982 // If we changed the generator's batch state, restore original batch state. 1987 // If we changed the generator's batch state, restore original batch state.
1983 if (!already_in_batch_mode_) { 1988 if (!already_in_batch_mode_) {
1984 DVLOG(1) << "Leaving Batch Mode."; 1989 DVLOG(1) << "Leaving Batch Mode.";
1985 connection_->packet_generator_.FinishBatchOperations(); 1990 connection_->packet_generator_.FinishBatchOperations();
1986 } 1991 }
1987 DCHECK_EQ(already_in_batch_mode_, 1992 DCHECK_EQ(already_in_batch_mode_,
1988 connection_->packet_generator_.InBatchMode()); 1993 connection_->packet_generator_.InBatchMode());
1989 } 1994 }
1990 1995
1991 } // namespace net 1996 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_connection.h ('k') | net/quic/quic_connection_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698