| 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/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 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 }; | 197 }; |
| 198 | 198 |
| 199 } // namespace | 199 } // namespace |
| 200 | 200 |
| 201 #define ENDPOINT \ | 201 #define ENDPOINT \ |
| 202 (perspective_ == Perspective::IS_SERVER ? "Server: " : "Client: ") | 202 (perspective_ == Perspective::IS_SERVER ? "Server: " : "Client: ") |
| 203 | 203 |
| 204 QuicConnection::QuicConnection(QuicConnectionId connection_id, | 204 QuicConnection::QuicConnection(QuicConnectionId connection_id, |
| 205 IPEndPoint address, | 205 IPEndPoint address, |
| 206 QuicConnectionHelperInterface* helper, | 206 QuicConnectionHelperInterface* helper, |
| 207 QuicAlarmFactory* alarm_factory, |
| 207 QuicPacketWriter* writer, | 208 QuicPacketWriter* writer, |
| 208 bool owns_writer, | 209 bool owns_writer, |
| 209 Perspective perspective, | 210 Perspective perspective, |
| 210 const QuicVersionVector& supported_versions) | 211 const QuicVersionVector& supported_versions) |
| 211 : framer_(supported_versions, | 212 : framer_(supported_versions, |
| 212 helper->GetClock()->ApproximateNow(), | 213 helper->GetClock()->ApproximateNow(), |
| 213 perspective), | 214 perspective), |
| 214 helper_(helper), | 215 helper_(helper), |
| 216 alarm_factory_(alarm_factory), |
| 215 per_packet_options_(nullptr), | 217 per_packet_options_(nullptr), |
| 216 writer_(writer), | 218 writer_(writer), |
| 217 owns_writer_(owns_writer), | 219 owns_writer_(owns_writer), |
| 218 encryption_level_(ENCRYPTION_NONE), | 220 encryption_level_(ENCRYPTION_NONE), |
| 219 has_forward_secure_encrypter_(false), | 221 has_forward_secure_encrypter_(false), |
| 220 first_required_forward_secure_packet_(0), | 222 first_required_forward_secure_packet_(0), |
| 221 clock_(helper->GetClock()), | 223 clock_(helper->GetClock()), |
| 222 random_generator_(helper->GetRandomGenerator()), | 224 random_generator_(helper->GetRandomGenerator()), |
| 223 connection_id_(connection_id), | 225 connection_id_(connection_id), |
| 224 peer_address_(address), | 226 peer_address_(address), |
| (...skipping 16 matching lines...) Expand all Loading... |
| 241 ack_queued_(false), | 243 ack_queued_(false), |
| 242 num_retransmittable_packets_received_since_last_ack_sent_(0), | 244 num_retransmittable_packets_received_since_last_ack_sent_(0), |
| 243 last_ack_had_missing_packets_(false), | 245 last_ack_had_missing_packets_(false), |
| 244 num_packets_received_since_last_ack_sent_(0), | 246 num_packets_received_since_last_ack_sent_(0), |
| 245 stop_waiting_count_(0), | 247 stop_waiting_count_(0), |
| 246 ack_mode_(TCP_ACKING), | 248 ack_mode_(TCP_ACKING), |
| 247 delay_setting_retransmission_alarm_(false), | 249 delay_setting_retransmission_alarm_(false), |
| 248 pending_retransmission_alarm_(false), | 250 pending_retransmission_alarm_(false), |
| 249 defer_send_in_response_to_packets_(false), | 251 defer_send_in_response_to_packets_(false), |
| 250 arena_(), | 252 arena_(), |
| 251 ack_alarm_(helper->CreateAlarm(arena_.New<AckAlarm>(this), &arena_)), | 253 ack_alarm_( |
| 254 alarm_factory_->CreateAlarm(arena_.New<AckAlarm>(this), &arena_)), |
| 252 retransmission_alarm_( | 255 retransmission_alarm_( |
| 253 helper->CreateAlarm(arena_.New<RetransmissionAlarm>(this), &arena_)), | 256 alarm_factory_->CreateAlarm(arena_.New<RetransmissionAlarm>(this), |
| 254 send_alarm_(helper->CreateAlarm(arena_.New<SendAlarm>(this), &arena_)), | 257 &arena_)), |
| 258 send_alarm_( |
| 259 alarm_factory_->CreateAlarm(arena_.New<SendAlarm>(this), &arena_)), |
| 255 resume_writes_alarm_( | 260 resume_writes_alarm_( |
| 256 helper->CreateAlarm(arena_.New<SendAlarm>(this), &arena_)), | 261 alarm_factory_->CreateAlarm(arena_.New<SendAlarm>(this), &arena_)), |
| 257 timeout_alarm_( | 262 timeout_alarm_( |
| 258 helper->CreateAlarm(arena_.New<TimeoutAlarm>(this), &arena_)), | 263 alarm_factory_->CreateAlarm(arena_.New<TimeoutAlarm>(this), &arena_)), |
| 259 ping_alarm_(helper->CreateAlarm(arena_.New<PingAlarm>(this), &arena_)), | 264 ping_alarm_( |
| 265 alarm_factory_->CreateAlarm(arena_.New<PingAlarm>(this), &arena_)), |
| 260 mtu_discovery_alarm_( | 266 mtu_discovery_alarm_( |
| 261 helper->CreateAlarm(arena_.New<MtuDiscoveryAlarm>(this), &arena_)), | 267 alarm_factory_->CreateAlarm(arena_.New<MtuDiscoveryAlarm>(this), |
| 268 &arena_)), |
| 262 visitor_(nullptr), | 269 visitor_(nullptr), |
| 263 debug_visitor_(nullptr), | 270 debug_visitor_(nullptr), |
| 264 packet_generator_(connection_id_, | 271 packet_generator_(connection_id_, |
| 265 &framer_, | 272 &framer_, |
| 266 random_generator_, | 273 random_generator_, |
| 267 helper->GetBufferAllocator(), | 274 helper->GetBufferAllocator(), |
| 268 this), | 275 this), |
| 269 idle_network_timeout_(QuicTime::Delta::Infinite()), | 276 idle_network_timeout_(QuicTime::Delta::Infinite()), |
| 270 handshake_timeout_(QuicTime::Delta::Infinite()), | 277 handshake_timeout_(QuicTime::Delta::Infinite()), |
| 271 time_of_last_received_packet_(clock_->ApproximateNow()), | 278 time_of_last_received_packet_(clock_->ApproximateNow()), |
| (...skipping 2077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2349 } | 2356 } |
| 2350 | 2357 |
| 2351 StringPiece QuicConnection::GetCurrentPacket() { | 2358 StringPiece QuicConnection::GetCurrentPacket() { |
| 2352 if (current_packet_data_ == nullptr) { | 2359 if (current_packet_data_ == nullptr) { |
| 2353 return StringPiece(); | 2360 return StringPiece(); |
| 2354 } | 2361 } |
| 2355 return StringPiece(current_packet_data_, last_size_); | 2362 return StringPiece(current_packet_data_, last_size_); |
| 2356 } | 2363 } |
| 2357 | 2364 |
| 2358 } // namespace net | 2365 } // namespace net |
| OLD | NEW |