| 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 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1296 if (!IsInitializedIPEndPoint(self_address_)) { | 1296 if (!IsInitializedIPEndPoint(self_address_)) { |
| 1297 self_address_ = last_packet_destination_address_; | 1297 self_address_ = last_packet_destination_address_; |
| 1298 } | 1298 } |
| 1299 if (!IsInitializedIPEndPoint(peer_address_)) { | 1299 if (!IsInitializedIPEndPoint(peer_address_)) { |
| 1300 peer_address_ = last_packet_source_address_; | 1300 peer_address_ = last_packet_source_address_; |
| 1301 } | 1301 } |
| 1302 | 1302 |
| 1303 stats_.bytes_received += packet.length(); | 1303 stats_.bytes_received += packet.length(); |
| 1304 ++stats_.packets_received; | 1304 ++stats_.packets_received; |
| 1305 | 1305 |
| 1306 if (FLAGS_quic_use_socket_timestamp) { | 1306 time_of_last_received_packet_ = packet.receipt_time(); |
| 1307 time_of_last_received_packet_ = packet.receipt_time(); | 1307 DVLOG(1) << ENDPOINT << "time of last received packet: " |
| 1308 DVLOG(1) << ENDPOINT << "time of last received packet: " | 1308 << time_of_last_received_packet_.ToDebuggingValue(); |
| 1309 << time_of_last_received_packet_.ToDebuggingValue(); | |
| 1310 } | |
| 1311 | 1309 |
| 1312 ScopedRetransmissionScheduler alarm_delayer(this); | 1310 ScopedRetransmissionScheduler alarm_delayer(this); |
| 1313 if (!framer_.ProcessPacket(packet)) { | 1311 if (!framer_.ProcessPacket(packet)) { |
| 1314 // If we are unable to decrypt this packet, it might be | 1312 // If we are unable to decrypt this packet, it might be |
| 1315 // because the CHLO or SHLO packet was lost. | 1313 // because the CHLO or SHLO packet was lost. |
| 1316 if (framer_.error() == QUIC_DECRYPTION_FAILURE) { | 1314 if (framer_.error() == QUIC_DECRYPTION_FAILURE) { |
| 1317 if (encryption_level_ != ENCRYPTION_FORWARD_SECURE && | 1315 if (encryption_level_ != ENCRYPTION_FORWARD_SECURE && |
| 1318 undecryptable_packets_.size() < max_undecryptable_packets_) { | 1316 undecryptable_packets_.size() < max_undecryptable_packets_) { |
| 1319 QueueUndecryptablePacket(packet); | 1317 QueueUndecryptablePacket(packet); |
| 1320 } else if (debug_visitor_ != nullptr) { | 1318 } else if (debug_visitor_ != nullptr) { |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1439 received_packet_manager_.SetVersion(version()); | 1437 received_packet_manager_.SetVersion(version()); |
| 1440 visitor_->OnSuccessfulVersionNegotiation(version()); | 1438 visitor_->OnSuccessfulVersionNegotiation(version()); |
| 1441 if (debug_visitor_ != nullptr) { | 1439 if (debug_visitor_ != nullptr) { |
| 1442 debug_visitor_->OnSuccessfulVersionNegotiation(version()); | 1440 debug_visitor_->OnSuccessfulVersionNegotiation(version()); |
| 1443 } | 1441 } |
| 1444 } | 1442 } |
| 1445 } | 1443 } |
| 1446 | 1444 |
| 1447 DCHECK_EQ(NEGOTIATED_VERSION, version_negotiation_state_); | 1445 DCHECK_EQ(NEGOTIATED_VERSION, version_negotiation_state_); |
| 1448 | 1446 |
| 1449 if (!FLAGS_quic_use_socket_timestamp) { | |
| 1450 time_of_last_received_packet_ = clock_->Now(); | |
| 1451 DVLOG(1) << ENDPOINT << "time of last received packet: " | |
| 1452 << time_of_last_received_packet_.ToDebuggingValue(); | |
| 1453 } | |
| 1454 | |
| 1455 if (last_size_ > largest_received_packet_size_) { | 1447 if (last_size_ > largest_received_packet_size_) { |
| 1456 largest_received_packet_size_ = last_size_; | 1448 largest_received_packet_size_ = last_size_; |
| 1457 } | 1449 } |
| 1458 | 1450 |
| 1459 if (perspective_ == Perspective::IS_SERVER && | 1451 if (perspective_ == Perspective::IS_SERVER && |
| 1460 encryption_level_ == ENCRYPTION_NONE && | 1452 encryption_level_ == ENCRYPTION_NONE && |
| 1461 last_size_ > packet_generator_.GetCurrentMaxPacketLength()) { | 1453 last_size_ > packet_generator_.GetCurrentMaxPacketLength()) { |
| 1462 SetMaxPacketLength(last_size_); | 1454 SetMaxPacketLength(last_size_); |
| 1463 } | 1455 } |
| 1464 return true; | 1456 return true; |
| (...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2423 } | 2415 } |
| 2424 | 2416 |
| 2425 StringPiece QuicConnection::GetCurrentPacket() { | 2417 StringPiece QuicConnection::GetCurrentPacket() { |
| 2426 if (current_packet_data_ == nullptr) { | 2418 if (current_packet_data_ == nullptr) { |
| 2427 return StringPiece(); | 2419 return StringPiece(); |
| 2428 } | 2420 } |
| 2429 return StringPiece(current_packet_data_, last_size_); | 2421 return StringPiece(current_packet_data_, last_size_); |
| 2430 } | 2422 } |
| 2431 | 2423 |
| 2432 } // namespace net | 2424 } // namespace net |
| OLD | NEW |