| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 return delta <= kMaxPacketGap; | 67 return delta <= kMaxPacketGap; |
| 68 } | 68 } |
| 69 | 69 |
| 70 } // namespace | 70 } // namespace |
| 71 | 71 |
| 72 QuicConnection::UnackedPacket::UnackedPacket(QuicFrames unacked_frames) | 72 QuicConnection::UnackedPacket::UnackedPacket(QuicFrames unacked_frames) |
| 73 : frames(unacked_frames) { | 73 : frames(unacked_frames) { |
| 74 } | 74 } |
| 75 | 75 |
| 76 QuicConnection::UnackedPacket::UnackedPacket(QuicFrames unacked_frames, | 76 QuicConnection::UnackedPacket::UnackedPacket(QuicFrames unacked_frames, |
| 77 std::string data) | 77 string data) |
| 78 : frames(unacked_frames), | 78 : frames(unacked_frames), |
| 79 data(data) { | 79 data(data) { |
| 80 } | 80 } |
| 81 | 81 |
| 82 QuicConnection::UnackedPacket::~UnackedPacket() { | 82 QuicConnection::UnackedPacket::~UnackedPacket() { |
| 83 } | 83 } |
| 84 | 84 |
| 85 QuicConnection::QuicConnection(QuicGuid guid, | 85 QuicConnection::QuicConnection(QuicGuid guid, |
| 86 IPEndPoint address, | 86 IPEndPoint address, |
| 87 QuicConnectionHelperInterface* helper) | 87 QuicConnectionHelperInterface* helper) |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 DLOG(INFO) << "Connection closed with error " | 475 DLOG(INFO) << "Connection closed with error " |
| 476 << QuicUtils::ErrorToString(frame.error_code); | 476 << QuicUtils::ErrorToString(frame.error_code); |
| 477 CloseConnection(frame.error_code, true); | 477 CloseConnection(frame.error_code, true); |
| 478 } | 478 } |
| 479 | 479 |
| 480 void QuicConnection::OnPacketComplete() { | 480 void QuicConnection::OnPacketComplete() { |
| 481 if (!last_packet_revived_) { | 481 if (!last_packet_revived_) { |
| 482 DLOG(INFO) << "Got packet " << last_header_.packet_sequence_number | 482 DLOG(INFO) << "Got packet " << last_header_.packet_sequence_number |
| 483 << " with " << last_stream_frames_.size() | 483 << " with " << last_stream_frames_.size() |
| 484 << " stream frames for " << last_header_.public_header.guid; | 484 << " stream frames for " << last_header_.public_header.guid; |
| 485 congestion_manager_.RecordIncomingPacket(last_size_, | 485 congestion_manager_.RecordIncomingPacket( |
| 486 last_header_.packet_sequence_number, time_of_last_received_packet_, | 486 last_size_, last_header_.packet_sequence_number, |
| 487 last_packet_revived_); | 487 time_of_last_received_packet_, last_packet_revived_); |
| 488 } else { | 488 } else { |
| 489 DLOG(INFO) << "Got revived packet with " << last_stream_frames_.size() | 489 DLOG(INFO) << "Got revived packet with " << last_stream_frames_.size() |
| 490 << " frames."; | 490 << " frames."; |
| 491 } | 491 } |
| 492 | 492 |
| 493 if (last_stream_frames_.empty() || | 493 if (last_stream_frames_.empty() || |
| 494 visitor_->OnPacket(self_address_, peer_address_, | 494 visitor_->OnPacket(self_address_, peer_address_, |
| 495 last_header_, last_stream_frames_)) { | 495 last_header_, last_stream_frames_)) { |
| 496 RecordPacketReceived(last_header_); | 496 RecordPacketReceived(last_header_); |
| 497 } | 497 } |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1058 << " delta:" << delta.ToMicroseconds(); | 1058 << " delta:" << delta.ToMicroseconds(); |
| 1059 if (delta >= timeout_) { | 1059 if (delta >= timeout_) { |
| 1060 SendConnectionClose(QUIC_CONNECTION_TIMED_OUT); | 1060 SendConnectionClose(QUIC_CONNECTION_TIMED_OUT); |
| 1061 return true; | 1061 return true; |
| 1062 } | 1062 } |
| 1063 helper_->SetTimeoutAlarm(timeout_.Subtract(delta)); | 1063 helper_->SetTimeoutAlarm(timeout_.Subtract(delta)); |
| 1064 return false; | 1064 return false; |
| 1065 } | 1065 } |
| 1066 | 1066 |
| 1067 } // namespace net | 1067 } // namespace net |
| OLD | NEW |