diff options
author | rtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-19 10:52:04 +0000 |
---|---|---|
committer | rtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-19 10:52:04 +0000 |
commit | 691f45a982c0d5712311602ffff746a0e631e63f (patch) | |
tree | 558b690f1a5b816e2e63d7c5f005f55a6c0aa17b /net/quic/quic_crypto_server_stream.cc | |
parent | be06dec5b64b67d6f40dd7b58f18d376a16f442c (diff) | |
download | chromium_src-691f45a982c0d5712311602ffff746a0e631e63f.zip chromium_src-691f45a982c0d5712311602ffff746a0e631e63f.tar.gz chromium_src-691f45a982c0d5712311602ffff746a0e631e63f.tar.bz2 |
Land Recent QUIC Changes.
QUIC - manually sync'ing changes between chrome and internal source
code.
Refactorings to QuicCryptoServerConfig to allow for async quic client
hello validation.
Merge internal change: 56375103
- Remove the QuicConnectionPeer::GetCongestionManager method (can call
QuicConnection()::congestion_manager() directly now).
- Update a bunch of CongestionManager/SendAlgorithm methods to be const.
Merge internal change: 56361306
Change the QuicDispatcher to immediately put packets in time wait when
there is no version negotiation packet, instead of creating a new
session.
Merge internal change: 56353674
Add a new PacingSender which can be used to add pacing on top of an
existing QUIC sender.
Merge internal change: 56183480
Move StrikeRegisterClient to gfe/quic/crypto, so that
QuicCryptoServerConfig can depend on it. Implement a
StrikeRegisterClient that queries a local StrikeRegister.
See internal CL 56173502 for use cases.
Merge internal change: 56316281
R=rch@chromium.org
Review URL: https://codereview.chromium.org/75163007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@235976 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/quic/quic_crypto_server_stream.cc')
-rw-r--r-- | net/quic/quic_crypto_server_stream.cc | 53 |
1 files changed, 49 insertions, 4 deletions
diff --git a/net/quic/quic_crypto_server_stream.cc b/net/quic/quic_crypto_server_stream.cc index 1234483..fdef9bf 100644 --- a/net/quic/quic_crypto_server_stream.cc +++ b/net/quic/quic_crypto_server_stream.cc @@ -19,10 +19,15 @@ QuicCryptoServerStream::QuicCryptoServerStream( const QuicCryptoServerConfig& crypto_config, QuicSession* session) : QuicCryptoStream(session), - crypto_config_(crypto_config) { + crypto_config_(crypto_config), + validate_client_hello_cb_(NULL) { } QuicCryptoServerStream::~QuicCryptoServerStream() { + // Detach from the validation callback. + if (validate_client_hello_cb_ != NULL) { + validate_client_hello_cb_->Cancel(); + } } void QuicCryptoServerStream::OnHandshakeMessage( @@ -40,10 +45,33 @@ void QuicCryptoServerStream::OnHandshakeMessage( return; } + if (validate_client_hello_cb_ != NULL) { + // Already processing some other handshake message. The protocol + // does not allow for clients to send multiple handshake messages + // before the server has a chance to respond. + CloseConnection(QUIC_CRYPTO_MESSAGE_WHILE_VALIDATING_CLIENT_HELLO); + return; + } + + validate_client_hello_cb_ = new ValidateCallback(this); + return crypto_config_.ValidateClientHello( + message, + session()->connection()->peer_address(), + session()->connection()->clock(), + validate_client_hello_cb_); +} + +void QuicCryptoServerStream::FinishProcessingHandshakeMessage( + const CryptoHandshakeMessage& message, + const ValidateClientHelloResultCallback::Result& result) { + // Clear the callback that got us here. + DCHECK(validate_client_hello_cb_ != NULL); + validate_client_hello_cb_ = NULL; + string error_details; CryptoHandshakeMessage reply; - - QuicErrorCode error = ProcessClientHello(message, &reply, &error_details); + QuicErrorCode error = ProcessClientHello( + message, result, &reply, &error_details); if (error != QUIC_NO_ERROR) { CloseConnectionWithDetails(error, error_details); @@ -128,10 +156,11 @@ bool QuicCryptoServerStream::GetBase64SHA256ClientChannelID( QuicErrorCode QuicCryptoServerStream::ProcessClientHello( const CryptoHandshakeMessage& message, + const ValidateClientHelloResultCallback::Result& result, CryptoHandshakeMessage* reply, string* error_details) { return crypto_config_.ProcessClientHello( - message, + result, session()->connection()->guid(), session()->connection()->peer_address(), session()->connection()->clock(), @@ -139,4 +168,20 @@ QuicErrorCode QuicCryptoServerStream::ProcessClientHello( &crypto_negotiated_params_, reply, error_details); } +QuicCryptoServerStream::ValidateCallback::ValidateCallback( + QuicCryptoServerStream* parent) : parent_(parent) { +} + +void QuicCryptoServerStream::ValidateCallback::Cancel() { + parent_ = NULL; +} + +void QuicCryptoServerStream::ValidateCallback::RunImpl( + const CryptoHandshakeMessage& client_hello, + const Result& result) { + if (parent_ != NULL) { + parent_->FinishProcessingHandshakeMessage(client_hello, result); + } +} + } // namespace net |