Change parameter list of QuicConnection::OnConnectionClosed upcall
Parameter list was the individual fields of the Connection Close frame.
Now, the QuicConnectionCloseFrame is passed up. This object contains
all the parameters of the frame.
gfe-relnote: N/A, not flag protected. This change just rearranges function parameters.
PiperOrigin-RevId: 254406883
Change-Id: I6c11b7d7a09d5e765f385d8d54a56c02687e7894
diff --git a/quic/quartc/quartc_endpoint.cc b/quic/quartc/quartc_endpoint.cc
index faee615..7d01ce8 100644
--- a/quic/quartc/quartc_endpoint.cc
+++ b/quic/quartc/quartc_endpoint.cc
@@ -100,11 +100,11 @@
latest_rtt);
}
-void QuartcClientEndpoint::OnConnectionClosed(QuicErrorCode error_code,
- const std::string& error_details,
- ConnectionCloseSource source) {
+void QuartcClientEndpoint::OnConnectionClosed(
+ const QuicConnectionCloseFrame& frame,
+ ConnectionCloseSource source) {
// First, see if we can restart the session with a mutually-supported version.
- if (error_code == QUIC_INVALID_VERSION && session_ &&
+ if (frame.quic_error_code == QUIC_INVALID_VERSION && session_ &&
session_->connection() &&
!session_->connection()->server_supported_versions().empty()) {
for (const auto& client_version :
@@ -122,7 +122,7 @@
// Permanent version negotiation errors are forwarded to the |delegate_|,
// along with all other errors.
- delegate_->OnConnectionClosed(error_code, error_details, source);
+ delegate_->OnConnectionClosed(frame, source);
}
void QuartcClientEndpoint::OnMessageReceived(QuicStringPiece message) {
diff --git a/quic/quartc/quartc_endpoint.h b/quic/quartc/quartc_endpoint.h
index df6f056..51f35ce 100644
--- a/quic/quartc/quartc_endpoint.h
+++ b/quic/quartc/quartc_endpoint.h
@@ -83,8 +83,7 @@
void OnCongestionControlChange(QuicBandwidth bandwidth_estimate,
QuicBandwidth pacing_rate,
QuicTime::Delta latest_rtt) override;
- void OnConnectionClosed(QuicErrorCode error_code,
- const std::string& error_details,
+ void OnConnectionClosed(const QuicConnectionCloseFrame& frame,
ConnectionCloseSource source) override;
void OnMessageReceived(QuicStringPiece message) override;
void OnMessageSent(int64_t datagram_id) override;
diff --git a/quic/quartc/quartc_fakes.h b/quic/quartc/quartc_fakes.h
index 8b86064..91ea9a9 100644
--- a/quic/quartc/quartc_fakes.h
+++ b/quic/quartc/quartc_fakes.h
@@ -43,8 +43,7 @@
}
// Called when connection closes locally, or remotely by peer.
- void OnConnectionClosed(QuicErrorCode /*error_code*/,
- const std::string& /*error_details*/,
+ void OnConnectionClosed(const QuicConnectionCloseFrame& /*frame*/,
ConnectionCloseSource /*source*/) override {
connected_ = false;
}
diff --git a/quic/quartc/quartc_session.cc b/quic/quartc/quartc_session.cc
index e332613..93f32bb 100644
--- a/quic/quartc/quartc_session.cc
+++ b/quic/quartc/quartc_session.cc
@@ -206,12 +206,11 @@
return GetNumOpenDynamicStreams() > 0;
}
-void QuartcSession::OnConnectionClosed(QuicErrorCode error,
- const std::string& error_details,
+void QuartcSession::OnConnectionClosed(const QuicConnectionCloseFrame& frame,
ConnectionCloseSource source) {
- QuicSession::OnConnectionClosed(error, error_details, source);
+ QuicSession::OnConnectionClosed(frame, source);
DCHECK(session_delegate_);
- session_delegate_->OnConnectionClosed(error, error_details, source);
+ session_delegate_->OnConnectionClosed(frame, source);
}
void QuartcSession::CloseConnection(const std::string& details) {
diff --git a/quic/quartc/quartc_session.h b/quic/quartc/quartc_session.h
index 6cd1a20..6e7ab6c 100644
--- a/quic/quartc/quartc_session.h
+++ b/quic/quartc/quartc_session.h
@@ -81,8 +81,7 @@
void OnCanWrite() override;
bool SendProbingData() override;
- void OnConnectionClosed(QuicErrorCode error,
- const std::string& error_details,
+ void OnConnectionClosed(const QuicConnectionCloseFrame& frame,
ConnectionCloseSource source) override;
// QuartcSession methods.
@@ -134,8 +133,7 @@
// Called when the connection is closed. This means all of the streams will
// be closed and no new streams can be created.
- virtual void OnConnectionClosed(QuicErrorCode error_code,
- const std::string& error_details,
+ virtual void OnConnectionClosed(const QuicConnectionCloseFrame& frame,
ConnectionCloseSource source) = 0;
// Called when message (sent as SendMessage) is received.
diff --git a/quic/quartc/test/quartc_peer.cc b/quic/quartc/test/quartc_peer.cc
index 0a24187..d5e0d90 100644
--- a/quic/quartc/test/quartc_peer.cc
+++ b/quic/quartc/test/quartc_peer.cc
@@ -90,11 +90,9 @@
}
}
-void QuartcPeer::OnConnectionClosed(QuicErrorCode error_code,
- const std::string& error_details,
+void QuartcPeer::OnConnectionClosed(const QuicConnectionCloseFrame& frame,
ConnectionCloseSource /*source*/) {
- QUIC_LOG(INFO) << "Connection closed, error=" << error_code
- << ", details=" << error_details;
+ QUIC_LOG(INFO) << "Connection closed, frame=" << frame;
SetEnabled(false);
}
diff --git a/quic/quartc/test/quartc_peer.h b/quic/quartc/test/quartc_peer.h
index 2eab393..828b1e2 100644
--- a/quic/quartc/test/quartc_peer.h
+++ b/quic/quartc/test/quartc_peer.h
@@ -80,8 +80,7 @@
void OnCongestionControlChange(QuicBandwidth bandwidth_estimate,
QuicBandwidth pacing_rate,
QuicTime::Delta latest_rtt) override;
- void OnConnectionClosed(QuicErrorCode error_code,
- const std::string& error_details,
+ void OnConnectionClosed(const QuicConnectionCloseFrame& frame,
ConnectionCloseSource source) override;
void OnMessageReceived(QuicStringPiece message) override;
void OnMessageSent(int64_t /*datagram_id*/) override {}
diff --git a/quic/quartc/test/quic_trace_interceptor.cc b/quic/quartc/test/quic_trace_interceptor.cc
index dc10c38..9a9c638 100644
--- a/quic/quartc/test/quic_trace_interceptor.cc
+++ b/quic/quartc/test/quic_trace_interceptor.cc
@@ -53,10 +53,10 @@
latest_rtt);
}
-void QuicTraceInterceptor::OnConnectionClosed(QuicErrorCode error_code,
- const std::string& error_details,
- ConnectionCloseSource source) {
- delegate_->OnConnectionClosed(error_code, error_details, source);
+void QuicTraceInterceptor::OnConnectionClosed(
+ const QuicConnectionCloseFrame& frame,
+ ConnectionCloseSource source) {
+ delegate_->OnConnectionClosed(frame, source);
}
void QuicTraceInterceptor::OnMessageReceived(QuicStringPiece message) {
diff --git a/quic/quartc/test/quic_trace_interceptor.h b/quic/quartc/test/quic_trace_interceptor.h
index 263b596..df283af 100644
--- a/quic/quartc/test/quic_trace_interceptor.h
+++ b/quic/quartc/test/quic_trace_interceptor.h
@@ -34,8 +34,7 @@
void OnCongestionControlChange(QuicBandwidth bandwidth_estimate,
QuicBandwidth pacing_rate,
QuicTime::Delta latest_rtt) override;
- void OnConnectionClosed(QuicErrorCode error_code,
- const std::string& error_details,
+ void OnConnectionClosed(const QuicConnectionCloseFrame& frame,
ConnectionCloseSource source) override;
void OnMessageReceived(QuicStringPiece message) override;
void OnMessageSent(int64_t datagram_id) override;