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 #include <algorithm> | 9 #include <algorithm> |
10 #include <iterator> | 10 #include <iterator> |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 sent_packet_manager_( | 230 sent_packet_manager_( |
231 is_server, clock_, &stats_, kCubic, | 231 is_server, clock_, &stats_, kCubic, |
232 FLAGS_quic_use_time_loss_detection ? kTime : kNack), | 232 FLAGS_quic_use_time_loss_detection ? kTime : kNack), |
233 version_negotiation_state_(START_NEGOTIATION), | 233 version_negotiation_state_(START_NEGOTIATION), |
234 is_server_(is_server), | 234 is_server_(is_server), |
235 connected_(true), | 235 connected_(true), |
236 peer_ip_changed_(false), | 236 peer_ip_changed_(false), |
237 peer_port_changed_(false), | 237 peer_port_changed_(false), |
238 self_ip_changed_(false), | 238 self_ip_changed_(false), |
239 self_port_changed_(false) { | 239 self_port_changed_(false) { |
| 240 #if 0 |
| 241 // TODO(rtenneti): Should we enable this code in chromium? |
240 if (!is_server_) { | 242 if (!is_server_) { |
241 // Pacing will be enabled if the client negotiates it. | 243 // Pacing will be enabled if the client negotiates it. |
242 sent_packet_manager_.MaybeEnablePacing(); | 244 sent_packet_manager_.MaybeEnablePacing(); |
243 } | 245 } |
| 246 #endif |
244 DVLOG(1) << ENDPOINT << "Created connection with connection_id: " | 247 DVLOG(1) << ENDPOINT << "Created connection with connection_id: " |
245 << connection_id; | 248 << connection_id; |
246 timeout_alarm_->Set(clock_->ApproximateNow().Add(idle_network_timeout_)); | 249 timeout_alarm_->Set(clock_->ApproximateNow().Add(idle_network_timeout_)); |
247 framer_.set_visitor(this); | 250 framer_.set_visitor(this); |
248 framer_.set_received_entropy_calculator(&received_packet_manager_); | 251 framer_.set_received_entropy_calculator(&received_packet_manager_); |
249 stats_.connection_creation_time = clock_->ApproximateNow(); | 252 stats_.connection_creation_time = clock_->ApproximateNow(); |
250 sent_packet_manager_.set_network_change_visitor(&packet_generator_); | 253 sent_packet_manager_.set_network_change_visitor(&packet_generator_); |
251 } | 254 } |
252 | 255 |
253 QuicConnection::~QuicConnection() { | 256 QuicConnection::~QuicConnection() { |
(...skipping 1437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1691 ++stats_.packets_processed; | 1694 ++stats_.packets_processed; |
1692 delete packet; | 1695 delete packet; |
1693 undecryptable_packets_.pop_front(); | 1696 undecryptable_packets_.pop_front(); |
1694 } | 1697 } |
1695 | 1698 |
1696 // Once forward secure encryption is in use, there will be no | 1699 // Once forward secure encryption is in use, there will be no |
1697 // new keys installed and hence any undecryptable packets will | 1700 // new keys installed and hence any undecryptable packets will |
1698 // never be able to be decrypted. | 1701 // never be able to be decrypted. |
1699 if (encryption_level_ == ENCRYPTION_FORWARD_SECURE) { | 1702 if (encryption_level_ == ENCRYPTION_FORWARD_SECURE) { |
1700 if (debug_visitor_.get() != NULL) { | 1703 if (debug_visitor_.get() != NULL) { |
| 1704 // TODO(rtenneti): perhaps more efficient to pass the number of |
| 1705 // undecryptable packets as the argument to OnUndecryptablePacket so that |
| 1706 // we just need to call OnUndecryptablePacket once? |
1701 for (size_t i = 0; i < undecryptable_packets_.size(); ++i) { | 1707 for (size_t i = 0; i < undecryptable_packets_.size(); ++i) { |
1702 debug_visitor_->OnUndecryptablePacket(); | 1708 debug_visitor_->OnUndecryptablePacket(); |
1703 } | 1709 } |
1704 } | 1710 } |
1705 STLDeleteElements(&undecryptable_packets_); | 1711 STLDeleteElements(&undecryptable_packets_); |
1706 } | 1712 } |
1707 } | 1713 } |
1708 | 1714 |
1709 void QuicConnection::MaybeProcessRevivedPacket() { | 1715 void QuicConnection::MaybeProcessRevivedPacket() { |
1710 QuicFecGroup* group = GetFecGroup(); | 1716 QuicFecGroup* group = GetFecGroup(); |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1988 // If we changed the generator's batch state, restore original batch state. | 1994 // If we changed the generator's batch state, restore original batch state. |
1989 if (!already_in_batch_mode_) { | 1995 if (!already_in_batch_mode_) { |
1990 DVLOG(1) << "Leaving Batch Mode."; | 1996 DVLOG(1) << "Leaving Batch Mode."; |
1991 connection_->packet_generator_.FinishBatchOperations(); | 1997 connection_->packet_generator_.FinishBatchOperations(); |
1992 } | 1998 } |
1993 DCHECK_EQ(already_in_batch_mode_, | 1999 DCHECK_EQ(already_in_batch_mode_, |
1994 connection_->packet_generator_.InBatchMode()); | 2000 connection_->packet_generator_.InBatchMode()); |
1995 } | 2001 } |
1996 | 2002 |
1997 } // namespace net | 2003 } // namespace net |
OLD | NEW |