Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(468)

Side by Side Diff: net/quic/core/quic_connection.cc

Issue 2517513004: Move QUIC error code utility methods to quic_error_codes.{h,cc}, and rename them slightly. No beha… (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/net.gypi ('k') | net/quic/core/quic_crypto_stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/core/quic_connection.h" 5 #include "net/quic/core/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 848 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 } 859 }
860 860
861 bool QuicConnection::OnRstStreamFrame(const QuicRstStreamFrame& frame) { 861 bool QuicConnection::OnRstStreamFrame(const QuicRstStreamFrame& frame) {
862 DCHECK(connected_); 862 DCHECK(connected_);
863 if (debug_visitor_ != nullptr) { 863 if (debug_visitor_ != nullptr) {
864 debug_visitor_->OnRstStreamFrame(frame); 864 debug_visitor_->OnRstStreamFrame(frame);
865 } 865 }
866 DVLOG(1) << ENDPOINT 866 DVLOG(1) << ENDPOINT
867 << "RST_STREAM_FRAME received for stream: " << frame.stream_id 867 << "RST_STREAM_FRAME received for stream: " << frame.stream_id
868 << " with error: " 868 << " with error: "
869 << QuicUtils::StreamErrorToString(frame.error_code); 869 << QuicRstStreamErrorCodeToString(frame.error_code);
870 visitor_->OnRstStream(frame); 870 visitor_->OnRstStream(frame);
871 visitor_->PostProcessAfterData(); 871 visitor_->PostProcessAfterData();
872 should_last_packet_instigate_acks_ = true; 872 should_last_packet_instigate_acks_ = true;
873 return connected_; 873 return connected_;
874 } 874 }
875 875
876 bool QuicConnection::OnConnectionCloseFrame( 876 bool QuicConnection::OnConnectionCloseFrame(
877 const QuicConnectionCloseFrame& frame) { 877 const QuicConnectionCloseFrame& frame) {
878 DCHECK(connected_); 878 DCHECK(connected_);
879 if (debug_visitor_ != nullptr) { 879 if (debug_visitor_ != nullptr) {
880 debug_visitor_->OnConnectionCloseFrame(frame); 880 debug_visitor_->OnConnectionCloseFrame(frame);
881 } 881 }
882 DVLOG(1) << ENDPOINT 882 DVLOG(1) << ENDPOINT
883 << "Received ConnectionClose for connection: " << connection_id() 883 << "Received ConnectionClose for connection: " << connection_id()
884 << ", with error: " << QuicUtils::ErrorToString(frame.error_code) 884 << ", with error: " << QuicErrorCodeToString(frame.error_code)
885 << " (" << frame.error_details << ")"; 885 << " (" << frame.error_details << ")";
886 if (frame.error_code == QUIC_BAD_MULTIPATH_FLAG) { 886 if (frame.error_code == QUIC_BAD_MULTIPATH_FLAG) {
887 LOG(ERROR) << "Unexpected QUIC_BAD_MULTIPATH_FLAG error." 887 LOG(ERROR) << "Unexpected QUIC_BAD_MULTIPATH_FLAG error."
888 << " last_received_header: " << last_header_ 888 << " last_received_header: " << last_header_
889 << " encryption_level: " << encryption_level_; 889 << " encryption_level: " << encryption_level_;
890 } 890 }
891 TearDownLocalConnectionState(frame.error_code, frame.error_details, 891 TearDownLocalConnectionState(frame.error_code, frame.error_details,
892 ConnectionCloseSource::FROM_PEER); 892 ConnectionCloseSource::FROM_PEER);
893 return connected_; 893 return connected_;
894 } 894 }
895 895
896 bool QuicConnection::OnGoAwayFrame(const QuicGoAwayFrame& frame) { 896 bool QuicConnection::OnGoAwayFrame(const QuicGoAwayFrame& frame) {
897 DCHECK(connected_); 897 DCHECK(connected_);
898 if (debug_visitor_ != nullptr) { 898 if (debug_visitor_ != nullptr) {
899 debug_visitor_->OnGoAwayFrame(frame); 899 debug_visitor_->OnGoAwayFrame(frame);
900 } 900 }
901 DVLOG(1) << ENDPOINT << "GOAWAY_FRAME received with last good stream: " 901 DVLOG(1) << ENDPOINT << "GOAWAY_FRAME received with last good stream: "
902 << frame.last_good_stream_id 902 << frame.last_good_stream_id
903 << " and error: " << QuicUtils::ErrorToString(frame.error_code) 903 << " and error: " << QuicErrorCodeToString(frame.error_code)
904 << " and reason: " << frame.reason_phrase; 904 << " and reason: " << frame.reason_phrase;
905 905
906 goaway_received_ = true; 906 goaway_received_ = true;
907 visitor_->OnGoAway(frame); 907 visitor_->OnGoAway(frame);
908 visitor_->PostProcessAfterData(); 908 visitor_->PostProcessAfterData();
909 should_last_packet_instigate_acks_ = true; 909 should_last_packet_instigate_acks_ = true;
910 return connected_; 910 return connected_;
911 } 911 }
912 912
913 bool QuicConnection::OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) { 913 bool QuicConnection::OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) {
(...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after
1955 QuicErrorCode error, 1955 QuicErrorCode error,
1956 const string& error_details, 1956 const string& error_details,
1957 ConnectionCloseBehavior connection_close_behavior) { 1957 ConnectionCloseBehavior connection_close_behavior) {
1958 DCHECK(!error_details.empty()); 1958 DCHECK(!error_details.empty());
1959 if (!connected_) { 1959 if (!connected_) {
1960 DVLOG(1) << "Connection is already closed."; 1960 DVLOG(1) << "Connection is already closed.";
1961 return; 1961 return;
1962 } 1962 }
1963 1963
1964 DVLOG(1) << ENDPOINT << "Closing connection: " << connection_id() 1964 DVLOG(1) << ENDPOINT << "Closing connection: " << connection_id()
1965 << ", with error: " << QuicUtils::ErrorToString(error) << " (" 1965 << ", with error: " << QuicErrorCodeToString(error) << " (" << error
1966 << error << "), and details: " << error_details; 1966 << "), and details: " << error_details;
1967 1967
1968 if (connection_close_behavior == 1968 if (connection_close_behavior ==
1969 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET) { 1969 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET) {
1970 SendConnectionClosePacket(error, error_details, SEND_ACK); 1970 SendConnectionClosePacket(error, error_details, SEND_ACK);
1971 } else if (connection_close_behavior == 1971 } else if (connection_close_behavior ==
1972 ConnectionCloseBehavior:: 1972 ConnectionCloseBehavior::
1973 SEND_CONNECTION_CLOSE_PACKET_WITH_NO_ACK) { 1973 SEND_CONNECTION_CLOSE_PACKET_WITH_NO_ACK) {
1974 SendConnectionClosePacket(error, error_details, NO_ACK); 1974 SendConnectionClosePacket(error, error_details, NO_ACK);
1975 } 1975 }
1976 1976
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
2034 2034
2035 void QuicConnection::SendGoAway(QuicErrorCode error, 2035 void QuicConnection::SendGoAway(QuicErrorCode error,
2036 QuicStreamId last_good_stream_id, 2036 QuicStreamId last_good_stream_id,
2037 const string& reason) { 2037 const string& reason) {
2038 if (goaway_sent_) { 2038 if (goaway_sent_) {
2039 return; 2039 return;
2040 } 2040 }
2041 goaway_sent_ = true; 2041 goaway_sent_ = true;
2042 2042
2043 DVLOG(1) << ENDPOINT << "Going away with error " 2043 DVLOG(1) << ENDPOINT << "Going away with error "
2044 << QuicUtils::ErrorToString(error) << " (" << error << ")"; 2044 << QuicErrorCodeToString(error) << " (" << error << ")";
2045 2045
2046 // Opportunistically bundle an ack with this outgoing packet. 2046 // Opportunistically bundle an ack with this outgoing packet.
2047 ScopedPacketBundler ack_bundler(this, SEND_ACK_IF_PENDING); 2047 ScopedPacketBundler ack_bundler(this, SEND_ACK_IF_PENDING);
2048 packet_generator_.AddControlFrame( 2048 packet_generator_.AddControlFrame(
2049 QuicFrame(new QuicGoAwayFrame(error, last_good_stream_id, reason))); 2049 QuicFrame(new QuicGoAwayFrame(error, last_good_stream_id, reason)));
2050 } 2050 }
2051 2051
2052 QuicByteCount QuicConnection::max_packet_length() const { 2052 QuicByteCount QuicConnection::max_packet_length() const {
2053 return packet_generator_.GetCurrentMaxPacketLength(); 2053 return packet_generator_.GetCurrentMaxPacketLength();
2054 } 2054 }
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
2480 2480
2481 void QuicConnection::CheckIfApplicationLimited() { 2481 void QuicConnection::CheckIfApplicationLimited() {
2482 if (queued_packets_.empty() && 2482 if (queued_packets_.empty() &&
2483 !sent_packet_manager_->HasPendingRetransmissions() && 2483 !sent_packet_manager_->HasPendingRetransmissions() &&
2484 !visitor_->WillingAndAbleToWrite()) { 2484 !visitor_->WillingAndAbleToWrite()) {
2485 sent_packet_manager_->OnApplicationLimited(); 2485 sent_packet_manager_->OnApplicationLimited();
2486 } 2486 }
2487 } 2487 }
2488 2488
2489 } // namespace net 2489 } // namespace net
OLDNEW
« no previous file with comments | « net/net.gypi ('k') | net/quic/core/quic_crypto_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698