| 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 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 group->UpdateFec(last_decrypted_packet_level_, | 900 group->UpdateFec(last_decrypted_packet_level_, |
| 901 last_header_.packet_packet_number, fec); | 901 last_header_.packet_packet_number, fec); |
| 902 } | 902 } |
| 903 } | 903 } |
| 904 | 904 |
| 905 bool QuicConnection::OnRstStreamFrame(const QuicRstStreamFrame& frame) { | 905 bool QuicConnection::OnRstStreamFrame(const QuicRstStreamFrame& frame) { |
| 906 DCHECK(connected_); | 906 DCHECK(connected_); |
| 907 if (debug_visitor_ != nullptr) { | 907 if (debug_visitor_ != nullptr) { |
| 908 debug_visitor_->OnRstStreamFrame(frame); | 908 debug_visitor_->OnRstStreamFrame(frame); |
| 909 } | 909 } |
| 910 DVLOG(1) << ENDPOINT << "Stream reset with error " | 910 DVLOG(1) << ENDPOINT |
| 911 << "RST_STREAM_FRAME received for stream: " << frame.stream_id |
| 912 << " with error: " |
| 911 << QuicUtils::StreamErrorToString(frame.error_code); | 913 << QuicUtils::StreamErrorToString(frame.error_code); |
| 912 if (FLAGS_quic_process_frames_inline) { | 914 if (FLAGS_quic_process_frames_inline) { |
| 913 visitor_->OnRstStream(frame); | 915 visitor_->OnRstStream(frame); |
| 914 should_last_packet_instigate_acks_ = true; | 916 should_last_packet_instigate_acks_ = true; |
| 915 } else { | 917 } else { |
| 916 last_rst_frames_.push_back(frame); | 918 last_rst_frames_.push_back(frame); |
| 917 } | 919 } |
| 918 return connected_; | 920 return connected_; |
| 919 } | 921 } |
| 920 | 922 |
| 921 bool QuicConnection::OnConnectionCloseFrame( | 923 bool QuicConnection::OnConnectionCloseFrame( |
| 922 const QuicConnectionCloseFrame& frame) { | 924 const QuicConnectionCloseFrame& frame) { |
| 923 DCHECK(connected_); | 925 DCHECK(connected_); |
| 924 if (debug_visitor_ != nullptr) { | 926 if (debug_visitor_ != nullptr) { |
| 925 debug_visitor_->OnConnectionCloseFrame(frame); | 927 debug_visitor_->OnConnectionCloseFrame(frame); |
| 926 } | 928 } |
| 927 DVLOG(1) << ENDPOINT << "Connection " << connection_id() | 929 DVLOG(1) << ENDPOINT << "CONNECTION_CLOSE_FRAME received for connection: " |
| 928 << " closed with error " | 930 << connection_id() |
| 929 << QuicUtils::ErrorToString(frame.error_code) | 931 << " with error: " << QuicUtils::ErrorToString(frame.error_code) |
| 930 << " " << frame.error_details; | 932 << " " << frame.error_details; |
| 931 if (FLAGS_quic_process_frames_inline) { | 933 if (FLAGS_quic_process_frames_inline) { |
| 932 CloseConnection(frame.error_code, true); | 934 CloseConnection(frame.error_code, true); |
| 933 } else { | 935 } else { |
| 934 last_close_frames_.push_back(frame); | 936 last_close_frames_.push_back(frame); |
| 935 } | 937 } |
| 936 return connected_; | 938 return connected_; |
| 937 } | 939 } |
| 938 | 940 |
| 939 bool QuicConnection::OnGoAwayFrame(const QuicGoAwayFrame& frame) { | 941 bool QuicConnection::OnGoAwayFrame(const QuicGoAwayFrame& frame) { |
| 940 DCHECK(connected_); | 942 DCHECK(connected_); |
| 941 if (debug_visitor_ != nullptr) { | 943 if (debug_visitor_ != nullptr) { |
| 942 debug_visitor_->OnGoAwayFrame(frame); | 944 debug_visitor_->OnGoAwayFrame(frame); |
| 943 } | 945 } |
| 944 DVLOG(1) << ENDPOINT << "Go away received with error " | 946 DVLOG(1) << ENDPOINT << "GOAWAY_FRAME received with last good stream: " |
| 945 << QuicUtils::ErrorToString(frame.error_code) | 947 << frame.last_good_stream_id |
| 946 << " and reason:" << frame.reason_phrase; | 948 << " and error: " << QuicUtils::ErrorToString(frame.error_code) |
| 949 << " and reason: " << frame.reason_phrase; |
| 947 | 950 |
| 948 goaway_received_ = true; | 951 goaway_received_ = true; |
| 949 if (FLAGS_quic_process_frames_inline) { | 952 if (FLAGS_quic_process_frames_inline) { |
| 950 visitor_->OnGoAway(frame); | 953 visitor_->OnGoAway(frame); |
| 951 should_last_packet_instigate_acks_ = true; | 954 should_last_packet_instigate_acks_ = true; |
| 952 } else { | 955 } else { |
| 953 last_goaway_frames_.push_back(frame); | 956 last_goaway_frames_.push_back(frame); |
| 954 } | 957 } |
| 955 return connected_; | 958 return connected_; |
| 956 } | 959 } |
| 957 | 960 |
| 958 bool QuicConnection::OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) { | 961 bool QuicConnection::OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) { |
| 959 DCHECK(connected_); | 962 DCHECK(connected_); |
| 960 if (debug_visitor_ != nullptr) { | 963 if (debug_visitor_ != nullptr) { |
| 961 debug_visitor_->OnWindowUpdateFrame(frame); | 964 debug_visitor_->OnWindowUpdateFrame(frame); |
| 962 } | 965 } |
| 963 DVLOG(1) << ENDPOINT << "WindowUpdate received for stream: " | 966 DVLOG(1) << ENDPOINT |
| 964 << frame.stream_id << " with byte offset: " << frame.byte_offset; | 967 << "WINDOW_UPDATE_FRAME received for stream: " << frame.stream_id |
| 968 << " with byte offset: " << frame.byte_offset; |
| 965 if (FLAGS_quic_process_frames_inline) { | 969 if (FLAGS_quic_process_frames_inline) { |
| 966 visitor_->OnWindowUpdateFrame(frame); | 970 visitor_->OnWindowUpdateFrame(frame); |
| 967 should_last_packet_instigate_acks_ = true; | 971 should_last_packet_instigate_acks_ = true; |
| 968 } else { | 972 } else { |
| 969 last_window_update_frames_.push_back(frame); | 973 last_window_update_frames_.push_back(frame); |
| 970 } | 974 } |
| 971 return connected_; | 975 return connected_; |
| 972 } | 976 } |
| 973 | 977 |
| 974 bool QuicConnection::OnBlockedFrame(const QuicBlockedFrame& frame) { | 978 bool QuicConnection::OnBlockedFrame(const QuicBlockedFrame& frame) { |
| 975 DCHECK(connected_); | 979 DCHECK(connected_); |
| 976 if (debug_visitor_ != nullptr) { | 980 if (debug_visitor_ != nullptr) { |
| 977 debug_visitor_->OnBlockedFrame(frame); | 981 debug_visitor_->OnBlockedFrame(frame); |
| 978 } | 982 } |
| 979 DVLOG(1) << ENDPOINT << "Blocked frame received for stream: " | 983 DVLOG(1) << ENDPOINT |
| 980 << frame.stream_id; | 984 << "BLOCKED_FRAME received for stream: " << frame.stream_id; |
| 981 if (FLAGS_quic_process_frames_inline) { | 985 if (FLAGS_quic_process_frames_inline) { |
| 982 visitor_->OnBlockedFrame(frame); | 986 visitor_->OnBlockedFrame(frame); |
| 983 should_last_packet_instigate_acks_ = true; | 987 should_last_packet_instigate_acks_ = true; |
| 984 } else { | 988 } else { |
| 985 last_blocked_frames_.push_back(frame); | 989 last_blocked_frames_.push_back(frame); |
| 986 } | 990 } |
| 987 return connected_; | 991 return connected_; |
| 988 } | 992 } |
| 989 | 993 |
| 990 void QuicConnection::OnPacketComplete() { | 994 void QuicConnection::OnPacketComplete() { |
| (...skipping 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2449 packet_number_of_last_sent_packet_ + packets_between_mtu_probes_ + 1; | 2453 packet_number_of_last_sent_packet_ + packets_between_mtu_probes_ + 1; |
| 2450 ++mtu_probe_count_; | 2454 ++mtu_probe_count_; |
| 2451 | 2455 |
| 2452 DVLOG(2) << "Sending a path MTU discovery packet #" << mtu_probe_count_; | 2456 DVLOG(2) << "Sending a path MTU discovery packet #" << mtu_probe_count_; |
| 2453 SendMtuDiscoveryPacket(mtu_discovery_target_); | 2457 SendMtuDiscoveryPacket(mtu_discovery_target_); |
| 2454 | 2458 |
| 2455 DCHECK(!mtu_discovery_alarm_->IsSet()); | 2459 DCHECK(!mtu_discovery_alarm_->IsSet()); |
| 2456 } | 2460 } |
| 2457 | 2461 |
| 2458 } // namespace net | 2462 } // namespace net |
| OLD | NEW |