Chromium Code Reviews| Index: net/quic/quic_client_session.cc |
| diff --git a/net/quic/quic_client_session.cc b/net/quic/quic_client_session.cc |
| index 5e1e80f6911d9638a762af842a4aae75fb547f89..d5c8791dd6164bb96a8310c728b484e3e6b60550 100644 |
| --- a/net/quic/quic_client_session.cc |
| +++ b/net/quic/quic_client_session.cc |
| @@ -4,6 +4,7 @@ |
| #include "net/quic/quic_client_session.h" |
| +#include "base/callback_helpers.h" |
| #include "base/message_loop.h" |
| #include "base/stl_util.h" |
| #include "base/string_number_conversions.h" |
| @@ -50,13 +51,14 @@ QuicClientSession::QuicClientSession( |
| } |
| QuicClientSession::~QuicClientSession() { |
| + callback_.Reset(); |
|
Ryan Hamilton
2013/04/26 19:52:17
I though we were going to run the callback here wi
ramant (doing other things)
2013/04/30 02:17:03
Ran the callback_ if it is not NULL with error.
D
Ryan Hamilton
2013/04/30 02:56:14
I'm not sure I follow. Is the callback suposed to
ramant (doing other things)
2013/04/30 19:00:32
Changed the QuicClientSessionTest's GoAwayReceived
|
| connection()->set_debug_visitor(NULL); |
| net_log_.EndEvent(NetLog::TYPE_QUIC_SESSION); |
| } |
| QuicReliableClientStream* QuicClientSession::CreateOutgoingReliableStream() { |
| - if (!crypto_stream_->handshake_complete()) { |
| - DLOG(INFO) << "Crypto handshake not complete, no outgoing stream created."; |
| + if (!crypto_stream_->encryption_established()) { |
| + DLOG(INFO) << "Encryption not active so no outgoing stream created."; |
| return NULL; |
| } |
| if (GetNumOpenStreams() >= get_max_open_streams()) { |
| @@ -87,7 +89,7 @@ int QuicClientSession::CryptoConnect(const CompletionCallback& callback) { |
| return ERR_CONNECTION_FAILED; |
| } |
| - if (IsCryptoHandshakeComplete()) { |
| + if (IsCryptoHandshakeConfirmed()) { |
| return OK; |
| } |
| @@ -109,9 +111,11 @@ void QuicClientSession::CloseStream(QuicStreamId stream_id) { |
| } |
| } |
| -void QuicClientSession::OnCryptoHandshakeComplete(QuicErrorCode error) { |
| +void QuicClientSession::OnCryptoHandshakeEvent(CryptoHandshakeEvent event) { |
| if (!callback_.is_null()) { |
| - callback_.Run(error == QUIC_NO_ERROR ? OK : ERR_UNEXPECTED); |
| + // TODO(rtenneti): Currently for all CryptoHandshakeEvent events, callback_ |
| + // could send the data. Change the following code if that changes. |
| + base::ResetAndReturn(&callback_).Run(OK); |
| } |
| } |
| @@ -137,6 +141,9 @@ void QuicClientSession::StartReading() { |
| } |
| void QuicClientSession::CloseSessionOnError(int error) { |
|
Ryan Hamilton
2013/04/26 19:52:17
I think you also want to override QuicSession::Con
ramant (doing other things)
2013/04/30 02:17:03
Done.
|
| + if (!callback_.is_null()) { |
| + base::ResetAndReturn(&callback_).Run(error); |
| + } |
| while (!streams()->empty()) { |
| ReliableQuicStream* stream = streams()->begin()->second; |
| QuicStreamId id = stream->id(); |