Commit 1505a514 authored by rch@chromium.org's avatar rch@chromium.org

Report a more specific QUIC error when reading from the socket fails.

Review URL: https://chromiumcodereview.appspot.com/23532042

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221291 0039d316-1c4b-4281-b951-d872f2087c98
parent db7dcdc3
......@@ -334,25 +334,26 @@ void QuicClientSession::StartReading() {
void QuicClientSession::CloseSessionOnError(int error) {
UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.CloseSessionOnError", -error);
CloseSessionOnErrorInner(error);
CloseSessionOnErrorInner(error, QUIC_INTERNAL_ERROR);
NotifyFactoryOfSessionClose();
}
void QuicClientSession::CloseSessionOnErrorInner(int error) {
void QuicClientSession::CloseSessionOnErrorInner(int net_error,
QuicErrorCode quic_error) {
if (!callback_.is_null()) {
base::ResetAndReturn(&callback_).Run(error);
base::ResetAndReturn(&callback_).Run(net_error);
}
while (!streams()->empty()) {
ReliableQuicStream* stream = streams()->begin()->second;
QuicStreamId id = stream->id();
static_cast<QuicReliableClientStream*>(stream)->OnError(error);
static_cast<QuicReliableClientStream*>(stream)->OnError(net_error);
CloseStream(id);
}
net_log_.AddEvent(
NetLog::TYPE_QUIC_SESSION_CLOSE_ON_ERROR,
NetLog::IntegerCallback("net_error", error));
NetLog::IntegerCallback("net_error", net_error));
connection()->CloseConnection(QUIC_INTERNAL_ERROR, false);
connection()->CloseConnection(quic_error, false);
DCHECK(!connection()->connected());
}
......@@ -378,7 +379,8 @@ void QuicClientSession::OnReadComplete(int result) {
if (result < 0) {
DLOG(INFO) << "Closing session on read error: " << result;
CloseSessionOnErrorInner(result);
UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.ReadError", -result);
CloseSessionOnErrorInner(result, QUIC_PACKET_READ_ERROR);
NotifyFactoryOfSessionCloseLater();
return;
}
......
......@@ -148,7 +148,7 @@ class NET_EXPORT_PRIVATE QuicClientSession : public QuicSession {
void OnClosedStream();
void CloseSessionOnErrorInner(int error);
void CloseSessionOnErrorInner(int net_error, QuicErrorCode quic_error);
// Posts a task to notify the factory that this session has been closed.
void NotifyFactoryOfSessionCloseLater();
......
......@@ -350,8 +350,10 @@ enum QuicErrorCode {
QUIC_CONNECTION_TIMED_OUT = 25,
// There was an error encountered migrating addresses
QUIC_ERROR_MIGRATING_ADDRESS = 26,
// There was an error while writing the packet.
// There was an error while writing to the socket.
QUIC_PACKET_WRITE_ERROR = 27,
// There was an error while reading from the socket.
QUIC_PACKET_READ_ERROR = 51,
// Crypto errors.
......@@ -398,7 +400,7 @@ enum QuicErrorCode {
QUIC_CRYPTO_SERVER_CONFIG_EXPIRED = 45,
// No error. Used as bound while iterating.
QUIC_LAST_ERROR = 49,
QUIC_LAST_ERROR = 52,
};
struct NET_EXPORT_PRIVATE QuicPacketPublicHeader {
......
......@@ -181,6 +181,7 @@ const char* QuicUtils::ErrorToString(QuicErrorCode error) {
RETURN_STRING_LITERAL(QUIC_CONNECTION_TIMED_OUT);
RETURN_STRING_LITERAL(QUIC_ERROR_MIGRATING_ADDRESS);
RETURN_STRING_LITERAL(QUIC_PACKET_WRITE_ERROR);
RETURN_STRING_LITERAL(QUIC_PACKET_READ_ERROR);
RETURN_STRING_LITERAL(QUIC_PROOF_INVALID);
RETURN_STRING_LITERAL(QUIC_CRYPTO_DUPLICATE_TAG);
RETURN_STRING_LITERAL(QUIC_CRYPTO_ENCRYPTION_LEVEL_INCORRECT);
......
......@@ -7786,6 +7786,13 @@ other types of suffix sets.
<summary>Version of the QUIC protocol used for this connection.</summary>
</histogram>
<histogram name="Net.QuicSession.ReadError" enum="NetErrorCodes">
<summary>
The network error code returned when attempting to read to a QUIC
connection.
</summary>
</histogram>
<histogram name="Net.QuicSession.WriteError" enum="NetErrorCodes">
<summary>
The network error code returned when attempting to write to a QUIC
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment