| OLD | NEW | 
|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/domain_reliability/quic_error_mapping.h" | 5 #include "components/domain_reliability/quic_error_mapping.h" | 
| 6 | 6 | 
| 7 namespace domain_reliability { | 7 namespace domain_reliability { | 
| 8 | 8 | 
| 9 namespace { | 9 namespace { | 
| 10 | 10 | 
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 119     // The connection has too many outstanding received packets. | 119     // The connection has too many outstanding received packets. | 
| 120     {net::QUIC_TOO_MANY_OUTSTANDING_RECEIVED_PACKETS, | 120     {net::QUIC_TOO_MANY_OUTSTANDING_RECEIVED_PACKETS, | 
| 121      "quic.too_many_outstanding_received_packets"}, | 121      "quic.too_many_outstanding_received_packets"}, | 
| 122     // The quic connection job to load server config is cancelled. | 122     // The quic connection job to load server config is cancelled. | 
| 123     {net::QUIC_CONNECTION_CANCELLED, "quic.connection.cancelled"}, | 123     {net::QUIC_CONNECTION_CANCELLED, "quic.connection.cancelled"}, | 
| 124     // Disabled QUIC because of high packet loss rate. | 124     // Disabled QUIC because of high packet loss rate. | 
| 125     {net::QUIC_BAD_PACKET_LOSS_RATE, "quic.bad_packet_loss_rate"}, | 125     {net::QUIC_BAD_PACKET_LOSS_RATE, "quic.bad_packet_loss_rate"}, | 
| 126     // Disabled QUIC because of too many PUBLIC_RESETs post handshake. | 126     // Disabled QUIC because of too many PUBLIC_RESETs post handshake. | 
| 127     {net::QUIC_PUBLIC_RESETS_POST_HANDSHAKE, | 127     {net::QUIC_PUBLIC_RESETS_POST_HANDSHAKE, | 
| 128      "quic.public_resets_post_handshake"}, | 128      "quic.public_resets_post_handshake"}, | 
| 129     // Disabled QUIC because of too many timeouts with streams open. |  | 
| 130     {net::QUIC_TIMEOUTS_WITH_OPEN_STREAMS, "quic.timeouts_with_open_streams"}, |  | 
| 131     // Closed because we failed to serialize a packet. | 129     // Closed because we failed to serialize a packet. | 
| 132     {net::QUIC_FAILED_TO_SERIALIZE_PACKET, "quic.failed_to_serialize_packet"}, | 130     {net::QUIC_FAILED_TO_SERIALIZE_PACKET, "quic.failed_to_serialize_packet"}, | 
| 133     // QUIC timed out after too many RTOs. | 131     // QUIC timed out after too many RTOs. | 
| 134     {net::QUIC_TOO_MANY_RTOS, "quic.too_many_rtos"}, | 132     {net::QUIC_TOO_MANY_RTOS, "quic.too_many_rtos"}, | 
| 135     // Crypto errors. | 133     // Crypto errors. | 
| 136 | 134 | 
| 137     // Hanshake failed. | 135     // Hanshake failed. | 
| 138     {net::QUIC_HANDSHAKE_FAILED, "quic.handshake_failed"}, | 136     {net::QUIC_HANDSHAKE_FAILED, "quic.handshake_failed"}, | 
| 139     // Handshake message contained out of order tags. | 137     // Handshake message contained out of order tags. | 
| 140     {net::QUIC_CRYPTO_TAGS_OUT_OF_ORDER, "quic.crypto.tags_out_of_order"}, | 138     {net::QUIC_CRYPTO_TAGS_OUT_OF_ORDER, "quic.crypto.tags_out_of_order"}, | 
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 246     // Connection closed because of server hits max number of sessions allowed. | 244     // Connection closed because of server hits max number of sessions allowed. | 
| 247     {net::QUIC_TOO_MANY_SESSIONS_ON_SERVER, "quic.too_many_sessions_on_server"}, | 245     {net::QUIC_TOO_MANY_SESSIONS_ON_SERVER, "quic.too_many_sessions_on_server"}, | 
| 248     // There was an error decompressing data. | 246     // There was an error decompressing data. | 
| 249     {net::QUIC_DECOMPRESSION_FAILURE, "quic.decompression_failure"}, | 247     {net::QUIC_DECOMPRESSION_FAILURE, "quic.decompression_failure"}, | 
| 250 | 248 | 
| 251     // No error. Used as bound while iterating. | 249     // No error. Used as bound while iterating. | 
| 252     {net::QUIC_LAST_ERROR, "quic.last_error"}}; | 250     {net::QUIC_LAST_ERROR, "quic.last_error"}}; | 
| 253 | 251 | 
| 254 // Must be updated any time a net::QuicErrorCode is deprecated in | 252 // Must be updated any time a net::QuicErrorCode is deprecated in | 
| 255 // net/quic/core/quic_packets.h. | 253 // net/quic/core/quic_packets.h. | 
| 256 const int kDeprecatedQuicErrorCount = 4; | 254 const int kDeprecatedQuicErrorCount = 5; | 
| 257 const int kActiveQuicErrorCount = | 255 const int kActiveQuicErrorCount = | 
| 258     net::QUIC_LAST_ERROR - kDeprecatedQuicErrorCount; | 256     net::QUIC_LAST_ERROR - kDeprecatedQuicErrorCount; | 
| 259 | 257 | 
| 260 static_assert(arraysize(kQuicErrorMap) == kActiveQuicErrorCount, | 258 static_assert(arraysize(kQuicErrorMap) == kActiveQuicErrorCount, | 
| 261               "quic_error_map is not in sync with quic protocol!"); | 259               "quic_error_map is not in sync with quic protocol!"); | 
| 262 | 260 | 
| 263 }  // namespace | 261 }  // namespace | 
| 264 | 262 | 
| 265 // static | 263 // static | 
| 266 bool GetDomainReliabilityBeaconQuicError(net::QuicErrorCode quic_error, | 264 bool GetDomainReliabilityBeaconQuicError(net::QuicErrorCode quic_error, | 
| 267                                          std::string* beacon_quic_error_out) { | 265                                          std::string* beacon_quic_error_out) { | 
| 268   if (quic_error != net::QUIC_NO_ERROR) { | 266   if (quic_error != net::QUIC_NO_ERROR) { | 
| 269     // Convert a QUIC error. | 267     // Convert a QUIC error. | 
| 270     // TODO(juliatuttle): Consider sorting and using binary search? | 268     // TODO(juliatuttle): Consider sorting and using binary search? | 
| 271     for (size_t i = 0; i < arraysize(kQuicErrorMap); i++) { | 269     for (size_t i = 0; i < arraysize(kQuicErrorMap); i++) { | 
| 272       if (kQuicErrorMap[i].quic_error == quic_error) { | 270       if (kQuicErrorMap[i].quic_error == quic_error) { | 
| 273         *beacon_quic_error_out = kQuicErrorMap[i].beacon_quic_error; | 271         *beacon_quic_error_out = kQuicErrorMap[i].beacon_quic_error; | 
| 274         return true; | 272         return true; | 
| 275       } | 273       } | 
| 276     } | 274     } | 
| 277   } | 275   } | 
| 278   beacon_quic_error_out->clear(); | 276   beacon_quic_error_out->clear(); | 
| 279   return false; | 277   return false; | 
| 280 } | 278 } | 
| 281 | 279 | 
| 282 }  // namespace domain_reliability | 280 }  // namespace domain_reliability | 
| OLD | NEW | 
|---|