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

Unified Diff: net/quic/quic_connection.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_connection.h ('k') | net/quic/quic_crypto_client_stream.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_connection.cc
diff --git a/net/quic/quic_connection.cc b/net/quic/quic_connection.cc
index 3db67294fbf4b822d7299ac88b6537edd713a94a..6a0eed32e371fd138bed9f4e43bd57708bebd912 100644
--- a/net/quic/quic_connection.cc
+++ b/net/quic/quic_connection.cc
@@ -686,7 +686,8 @@ bool QuicConnection::OnStreamFrame(const QuicStreamFrame& frame) {
last_decrypted_packet_level_ == ENCRYPTION_NONE) {
DLOG(WARNING) << ENDPOINT
<< "Received an unencrypted data frame: closing connection";
- SendConnectionClose(QUIC_UNENCRYPTED_STREAM_DATA);
+ SendConnectionCloseWithDetails(QUIC_UNENCRYPTED_STREAM_DATA,
+ "Unencrypted stream data seen");
return false;
}
visitor_->OnStreamFrame(frame);
@@ -707,8 +708,9 @@ bool QuicConnection::OnAckFrame(const QuicAckFrame& incoming_ack) {
return true;
}
- if (!ValidateAckFrame(incoming_ack)) {
- SendConnectionClose(QUIC_INVALID_ACK_DATA);
+ const char* error = ValidateAckFrame(incoming_ack);
+ if (error != nullptr) {
+ SendConnectionCloseWithDetails(QUIC_INVALID_ACK_DATA, error);
return false;
}
@@ -759,8 +761,9 @@ bool QuicConnection::OnStopWaitingFrame(const QuicStopWaitingFrame& frame) {
return true;
}
- if (!ValidateStopWaitingFrame(frame)) {
- SendConnectionClose(QUIC_INVALID_STOP_WAITING_DATA);
+ const char* error = ValidateStopWaitingFrame(frame);
+ if (error != nullptr) {
+ SendConnectionCloseWithDetails(QUIC_INVALID_STOP_WAITING_DATA, error);
return false;
}
@@ -781,13 +784,13 @@ bool QuicConnection::OnPingFrame(const QuicPingFrame& frame) {
return true;
}
-bool QuicConnection::ValidateAckFrame(const QuicAckFrame& incoming_ack) {
+const char* QuicConnection::ValidateAckFrame(const QuicAckFrame& incoming_ack) {
if (incoming_ack.largest_observed > packet_generator_.packet_number()) {
LOG(WARNING) << ENDPOINT << "Peer's observed unsent packet:"
<< incoming_ack.largest_observed << " vs "
<< packet_generator_.packet_number();
// We got an error for data we have not sent. Error out.
- return false;
+ return "Largest observed too high";
}
if (incoming_ack.largest_observed < sent_packet_manager_.largest_observed()) {
@@ -796,7 +799,7 @@ bool QuicConnection::ValidateAckFrame(const QuicAckFrame& incoming_ack) {
<< sent_packet_manager_.largest_observed();
// A new ack has a diminished largest_observed value. Error out.
// If this was an old packet, we wouldn't even have checked.
- return false;
+ return "Largest observed too low";
}
if (!incoming_ack.missing_packets.Empty() &&
@@ -805,7 +808,7 @@ bool QuicConnection::ValidateAckFrame(const QuicAckFrame& incoming_ack) {
<< incoming_ack.missing_packets.Max()
<< " which is greater than largest observed: "
<< incoming_ack.largest_observed;
- return false;
+ return "Missing packet higher than largest observed";
}
if (!incoming_ack.missing_packets.Empty() &&
@@ -815,14 +818,14 @@ bool QuicConnection::ValidateAckFrame(const QuicAckFrame& incoming_ack) {
<< incoming_ack.missing_packets.Min()
<< " which is smaller than least_packet_awaited_by_peer_: "
<< sent_packet_manager_.least_packet_awaited_by_peer();
- return false;
+ return "Missing packet smaller than least awaited";
}
if (!sent_entropy_manager_.IsValidEntropy(incoming_ack.largest_observed,
incoming_ack.missing_packets,
incoming_ack.entropy_hash)) {
LOG(WARNING) << ENDPOINT << "Peer sent invalid entropy.";
- return false;
+ return "Invalid entropy";
}
if (incoming_ack.latest_revived_packet != 0 &&
@@ -830,12 +833,12 @@ bool QuicConnection::ValidateAckFrame(const QuicAckFrame& incoming_ack) {
incoming_ack.latest_revived_packet)) {
LOG(WARNING) << ENDPOINT
<< "Peer specified revived packet which was not missing.";
- return false;
+ return "Invalid revived packet";
}
- return true;
+ return nullptr;
}
-bool QuicConnection::ValidateStopWaitingFrame(
+const char* QuicConnection::ValidateStopWaitingFrame(
const QuicStopWaitingFrame& stop_waiting) {
if (stop_waiting.least_unacked <
received_packet_manager_.peer_least_packet_awaiting_ack()) {
@@ -843,7 +846,7 @@ bool QuicConnection::ValidateStopWaitingFrame(
<< stop_waiting.least_unacked << " vs "
<< received_packet_manager_.peer_least_packet_awaiting_ack();
// We never process old ack frames, so this number should only increase.
- return false;
+ return "Least unacked too small";
}
if (stop_waiting.least_unacked > last_header_.packet_number) {
@@ -851,10 +854,10 @@ bool QuicConnection::ValidateStopWaitingFrame(
<< "Peer sent least_unacked:" << stop_waiting.least_unacked
<< " greater than the enclosing packet number:"
<< last_header_.packet_number;
- return false;
+ return "Least unacked too large";
}
- return true;
+ return nullptr;
}
void QuicConnection::OnFecData(StringPiece redundancy) {
@@ -2180,7 +2183,8 @@ void QuicConnection::CheckForTimeout() {
<< idle_network_timeout_.ToMicroseconds();
if (idle_duration >= idle_network_timeout_) {
DVLOG(1) << ENDPOINT << "Connection timedout due to no network activity.";
- SendConnectionClose(QUIC_CONNECTION_TIMED_OUT);
+ SendConnectionCloseWithDetails(QUIC_CONNECTION_TIMED_OUT,
+ "No recent network activity");
return;
}
@@ -2191,9 +2195,10 @@ void QuicConnection::CheckForTimeout() {
<< connected_duration.ToMicroseconds() << " overall timeout: "
<< overall_connection_timeout_.ToMicroseconds();
if (connected_duration >= overall_connection_timeout_) {
- DVLOG(1) << ENDPOINT <<
- "Connection timedout due to overall connection timeout.";
- SendConnectionClose(QUIC_CONNECTION_OVERALL_TIMED_OUT);
+ DVLOG(1) << ENDPOINT
+ << "Connection timedout due to overall connection timeout.";
+ SendConnectionCloseWithDetails(QUIC_CONNECTION_OVERALL_TIMED_OUT,
+ "Overall timeout expired");
return;
}
}
« no previous file with comments | « net/quic/quic_connection.h ('k') | net/quic/quic_crypto_client_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698