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

Unified Diff: net/quic/crypto/quic_crypto_client_config.cc

Issue 342863005: QUIC - Record reject reasons for CHLO message. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed lint errors Created 6 years, 6 months 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
Index: net/quic/crypto/quic_crypto_client_config.cc
diff --git a/net/quic/crypto/quic_crypto_client_config.cc b/net/quic/crypto/quic_crypto_client_config.cc
index b37befea03e661e50600e9ec3b5b2136cac00d8d..777b8c5e13af2c6fd7f98ed1dde6119f604d1200 100644
--- a/net/quic/crypto/quic_crypto_client_config.cc
+++ b/net/quic/crypto/quic_crypto_client_config.cc
@@ -4,6 +4,7 @@
#include "net/quic/crypto/quic_crypto_client_config.h"
+#include "base/metrics/sparse_histogram.h"
#include "base/stl_util.h"
#include "base/strings/string_util.h"
#include "net/quic/crypto/cert_compressor.h"
@@ -592,16 +593,45 @@ QuicErrorCode QuicCryptoClientConfig::ProcessRejection(
COMPILE_ASSERT(sizeof(QuicTag) == sizeof(uint32), header_out_of_sync);
if (rej.GetTaglist(kRREJ, &reject_reasons,
&num_reject_reasons) == QUIC_NO_ERROR) {
-#if defined(DEBUG)
+ uint32 packed_error = 0;
for (size_t i = 0; i < num_reject_reasons; ++i) {
- DVLOG(1) << "Reasons for rejection: " << reject_reasons[i];
+ HandshakeFailureReason reason =
+ static_cast<HandshakeFailureReason>(reject_reasons[i]);
+ packed_error |= RejectReasonToPackedError(reason);
}
-#endif
+ UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicClientHelloRejectReasons",
+ packed_error);
}
return QUIC_NO_ERROR;
}
+uint32 QuicCryptoClientConfig::RejectReasonToPackedError(
+ HandshakeFailureReason reason) {
+ enum RejectReasonShift {
+ CLIENT_NONCE_SHIFT = 5,
+ SERVER_NONCE_SHIFT = 10,
+ SERVER_CONFIG_SHIFT = 15,
+ SOURCE_ADDRESS_TOKEN_SHIFT = 20,
Ryan Hamilton 2014/06/21 03:02:29 If you were really excited, you could add some com
ramant (doing other things) 2014/06/23 17:27:35 Done.
+ };
+
+ if (reason < CLIENT_NONCE_UNKNOWN_FAILURE) {
+ return reason;
+ }
+ if (reason < SERVER_NONCE_INVALID_FAILURE) {
+ return (reason - CLIENT_NONCE_UNKNOWN_FAILURE + 1) << CLIENT_NONCE_SHIFT;
+ }
+ if (reason < SERVER_CONFIG_INCHOATE_HELLO_FAILURE) {
+ return (reason - SERVER_NONCE_INVALID_FAILURE + 1) << SERVER_NONCE_SHIFT;
+ }
+ if (reason < SOURCE_ADDRESS_TOKEN_INVALID_FAILURE) {
+ return (reason - SERVER_CONFIG_INCHOATE_HELLO_FAILURE + 1) <<
+ SERVER_CONFIG_SHIFT;
+ }
+ return (reason - SOURCE_ADDRESS_TOKEN_INVALID_FAILURE + 1) <<
+ SOURCE_ADDRESS_TOKEN_SHIFT;
+}
+
QuicErrorCode QuicCryptoClientConfig::ProcessServerHello(
const CryptoHandshakeMessage& server_hello,
QuicConnectionId connection_id,

Powered by Google App Engine
This is Rietveld 408576698