| 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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 if (!connected_ || framer->error() == QUIC_DECRYPTION_FAILURE) { | 254 if (!connected_ || framer->error() == QUIC_DECRYPTION_FAILURE) { |
| 255 return; | 255 return; |
| 256 } | 256 } |
| 257 SendConnectionCloseWithDetails(framer->error(), framer->detailed_error()); | 257 SendConnectionCloseWithDetails(framer->error(), framer->detailed_error()); |
| 258 } | 258 } |
| 259 | 259 |
| 260 void QuicConnection::OnPacket() { | 260 void QuicConnection::OnPacket() { |
| 261 DCHECK(last_stream_frames_.empty() && | 261 DCHECK(last_stream_frames_.empty() && |
| 262 last_goaway_frames_.empty() && | 262 last_goaway_frames_.empty() && |
| 263 last_window_update_frames_.empty() && | 263 last_window_update_frames_.empty() && |
| 264 last_blocked_frames_.empty() && |
| 264 last_rst_frames_.empty() && | 265 last_rst_frames_.empty() && |
| 265 last_ack_frames_.empty() && | 266 last_ack_frames_.empty() && |
| 266 last_congestion_frames_.empty() && | 267 last_congestion_frames_.empty() && |
| 267 last_stop_waiting_frames_.empty()); | 268 last_stop_waiting_frames_.empty()); |
| 268 } | 269 } |
| 269 | 270 |
| 270 void QuicConnection::OnPublicResetPacket( | 271 void QuicConnection::OnPublicResetPacket( |
| 271 const QuicPublicResetPacket& packet) { | 272 const QuicPublicResetPacket& packet) { |
| 272 if (debug_visitor_) { | 273 if (debug_visitor_) { |
| 273 debug_visitor_->OnPublicResetPacket(packet); | 274 debug_visitor_->OnPublicResetPacket(packet); |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 return; | 716 return; |
| 716 } | 717 } |
| 717 | 718 |
| 718 DVLOG(1) << ENDPOINT << (last_packet_revived_ ? "Revived" : "Got") | 719 DVLOG(1) << ENDPOINT << (last_packet_revived_ ? "Revived" : "Got") |
| 719 << " packet " << last_header_.packet_sequence_number | 720 << " packet " << last_header_.packet_sequence_number |
| 720 << " with " << last_ack_frames_.size() << " acks, " | 721 << " with " << last_ack_frames_.size() << " acks, " |
| 721 << last_congestion_frames_.size() << " congestions, " | 722 << last_congestion_frames_.size() << " congestions, " |
| 722 << last_stop_waiting_frames_.size() << " stop_waiting, " | 723 << last_stop_waiting_frames_.size() << " stop_waiting, " |
| 723 << last_goaway_frames_.size() << " goaways, " | 724 << last_goaway_frames_.size() << " goaways, " |
| 724 << last_window_update_frames_.size() << " window updates, " | 725 << last_window_update_frames_.size() << " window updates, " |
| 725 << last_rst_frames_.size() << " rsts, " | |
| 726 << last_blocked_frames_.size() << " blocked, " | 726 << last_blocked_frames_.size() << " blocked, " |
| 727 << last_rst_frames_.size() << " rsts, " | 727 << last_rst_frames_.size() << " rsts, " |
| 728 << last_close_frames_.size() << " closes, " | 728 << last_close_frames_.size() << " closes, " |
| 729 << last_stream_frames_.size() | 729 << last_stream_frames_.size() |
| 730 << " stream frames for " << last_header_.public_header.guid; | 730 << " stream frames for " << last_header_.public_header.guid; |
| 731 | 731 |
| 732 MaybeQueueAck(); | 732 MaybeQueueAck(); |
| 733 | 733 |
| 734 // Discard the packet if the visitor fails to process the stream frames. | 734 // Discard the packet if the visitor fails to process the stream frames. |
| 735 if (!last_stream_frames_.empty() && | 735 if (!last_stream_frames_.empty() && |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 | 806 |
| 807 if (ack_queued_) { | 807 if (ack_queued_) { |
| 808 ack_alarm_->Cancel(); | 808 ack_alarm_->Cancel(); |
| 809 } | 809 } |
| 810 } | 810 } |
| 811 | 811 |
| 812 void QuicConnection::ClearLastFrames() { | 812 void QuicConnection::ClearLastFrames() { |
| 813 last_stream_frames_.clear(); | 813 last_stream_frames_.clear(); |
| 814 last_goaway_frames_.clear(); | 814 last_goaway_frames_.clear(); |
| 815 last_window_update_frames_.clear(); | 815 last_window_update_frames_.clear(); |
| 816 last_blocked_frames_.clear(); |
| 816 last_rst_frames_.clear(); | 817 last_rst_frames_.clear(); |
| 817 last_ack_frames_.clear(); | 818 last_ack_frames_.clear(); |
| 818 last_stop_waiting_frames_.clear(); | 819 last_stop_waiting_frames_.clear(); |
| 819 last_congestion_frames_.clear(); | 820 last_congestion_frames_.clear(); |
| 820 } | 821 } |
| 821 | 822 |
| 822 QuicAckFrame* QuicConnection::CreateAckFrame() { | 823 QuicAckFrame* QuicConnection::CreateAckFrame() { |
| 823 QuicAckFrame* outgoing_ack = new QuicAckFrame(); | 824 QuicAckFrame* outgoing_ack = new QuicAckFrame(); |
| 824 received_packet_manager_.UpdateReceivedPacketInfo( | 825 received_packet_manager_.UpdateReceivedPacketInfo( |
| 825 &(outgoing_ack->received_info), clock_->ApproximateNow()); | 826 &(outgoing_ack->received_info), clock_->ApproximateNow()); |
| (...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1776 // If we changed the generator's batch state, restore original batch state. | 1777 // If we changed the generator's batch state, restore original batch state. |
| 1777 if (!already_in_batch_mode_) { | 1778 if (!already_in_batch_mode_) { |
| 1778 DVLOG(1) << "Leaving Batch Mode."; | 1779 DVLOG(1) << "Leaving Batch Mode."; |
| 1779 connection_->packet_generator_.FinishBatchOperations(); | 1780 connection_->packet_generator_.FinishBatchOperations(); |
| 1780 } | 1781 } |
| 1781 DCHECK_EQ(already_in_batch_mode_, | 1782 DCHECK_EQ(already_in_batch_mode_, |
| 1782 connection_->packet_generator_.InBatchMode()); | 1783 connection_->packet_generator_.InBatchMode()); |
| 1783 } | 1784 } |
| 1784 | 1785 |
| 1785 } // namespace net | 1786 } // namespace net |
| OLD | NEW |