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

Unified Diff: net/quic/quic_session.cc

Issue 1548783002: Adding details to most quic connection close calls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@110540464
Patch Set: Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_session.h ('k') | net/quic/quic_session_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_session.cc
diff --git a/net/quic/quic_session.cc b/net/quic/quic_session.cc
index 445792b48c1bf93d890a7618cc6c97ddca6958ad..e510afdcb36a24b0fd52a5a38be6b4ecbf4f781a 100644
--- a/net/quic/quic_session.cc
+++ b/net/quic/quic_session.cc
@@ -5,6 +5,7 @@
#include "net/quic/quic_session.h"
#include "base/stl_util.h"
+#include "base/strings/stringprintf.h"
#include "net/quic/crypto/proof_verifier.h"
#include "net/quic/quic_connection.h"
#include "net/quic/quic_flags.h"
@@ -404,8 +405,9 @@ void QuicSession::UpdateFlowControlOnFinalReceivedByteOffset(
flow_controller_.highest_received_byte_offset() + offset_diff)) {
// If the final offset violates flow control, close the connection now.
if (flow_controller_.FlowControlViolation()) {
- connection_->SendConnectionClose(
- QUIC_FLOW_CONTROL_RECEIVED_TOO_MUCH_DATA);
+ connection_->SendConnectionCloseWithDetails(
+ QUIC_FLOW_CONTROL_RECEIVED_TOO_MUCH_DATA,
+ "Connection level flow control violation");
return;
}
}
@@ -515,7 +517,8 @@ void QuicSession::OnNewStreamFlowControlWindow(QuicStreamOffset new_window) {
<< new_window
<< ", below default: " << kMinimumFlowControlSendWindow;
if (connection_->connected()) {
- connection_->SendConnectionClose(QUIC_FLOW_CONTROL_INVALID_WINDOW);
+ connection_->SendConnectionCloseWithDetails(
+ QUIC_FLOW_CONTROL_INVALID_WINDOW, "New stream window too low");
}
return;
}
@@ -535,7 +538,8 @@ void QuicSession::OnNewSessionFlowControlWindow(QuicStreamOffset new_window) {
<< new_window
<< ", below default: " << kMinimumFlowControlSendWindow;
if (connection_->connected()) {
- connection_->SendConnectionClose(QUIC_FLOW_CONTROL_INVALID_WINDOW);
+ connection_->SendConnectionCloseWithDetails(
+ QUIC_FLOW_CONTROL_INVALID_WINDOW, "New connection window too low");
}
return;
}
@@ -624,9 +628,10 @@ void QuicSession::StreamDraining(QuicStreamId stream_id) {
}
}
-void QuicSession::CloseConnection(QuicErrorCode error) {
+void QuicSession::CloseConnectionWithDetails(QuicErrorCode error,
+ const char* details) {
if (connection()->connected()) {
- connection()->SendConnectionClose(error);
+ connection()->SendConnectionCloseWithDetails(error, details);
}
}
@@ -650,7 +655,8 @@ ReliableQuicStream* QuicSession::GetOrCreateDynamicStream(
if (!IsIncomingStream(stream_id)) {
// Received a frame for a locally-created stream that is not currently
// active. This is an error.
- CloseConnection(QUIC_INVALID_STREAM_ID);
+ CloseConnectionWithDetails(QUIC_INVALID_STREAM_ID,
+ "Data for nonexistent stream");
return nullptr;
}
@@ -670,7 +676,11 @@ ReliableQuicStream* QuicSession::GetOrCreateDynamicStream(
<< " streams available, which would become "
<< new_num_available_streams << ", which exceeds the limit "
<< get_max_available_streams() << ".";
- CloseConnection(QUIC_TOO_MANY_AVAILABLE_STREAMS);
+ CloseConnectionWithDetails(
+ QUIC_TOO_MANY_AVAILABLE_STREAMS,
+ base::StringPrintf("%lu above %lu", new_num_available_streams,
+ get_max_available_streams())
+ .c_str());
return nullptr;
}
for (QuicStreamId id = largest_peer_created_stream_id_ + 2;
@@ -689,7 +699,8 @@ ReliableQuicStream* QuicSession::GetOrCreateDynamicStream(
locally_closed_streams_highest_offset_.size();
if (num_current_open_streams >= get_max_open_streams()) {
if (connection()->version() <= QUIC_VERSION_27) {
- CloseConnection(QUIC_TOO_MANY_OPEN_STREAMS);
+ CloseConnectionWithDetails(QUIC_TOO_MANY_OPEN_STREAMS,
+ "Old style stream rejection");
} else {
// Refuse to open the stream.
SendRstStream(stream_id, QUIC_REFUSED_STREAM, 0);
« no previous file with comments | « net/quic/quic_session.h ('k') | net/quic/quic_session_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698