| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "net/quic/quic_client_session.h" | 5 #include "net/quic/quic_client_session.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 new QuicReliableClientStream(GetNextStreamId(), this); | 45 new QuicReliableClientStream(GetNextStreamId(), this); |
| 46 ActivateStream(stream); | 46 ActivateStream(stream); |
| 47 return stream; | 47 return stream; |
| 48 } | 48 } |
| 49 | 49 |
| 50 QuicCryptoClientStream* QuicClientSession::GetCryptoStream() { | 50 QuicCryptoClientStream* QuicClientSession::GetCryptoStream() { |
| 51 return &crypto_stream_; | 51 return &crypto_stream_; |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 int QuicClientSession::CryptoConnect(const CompletionCallback& callback) { | 54 int QuicClientSession::CryptoConnect(const CompletionCallback& callback) { |
| 55 CryptoHandshakeMessage message; | 55 if (!crypto_stream_.CryptoConnect()) { |
| 56 message.tag = kCHLO; | 56 // TODO(wtc): change crypto_stream_.CryptoConnect() to return a |
| 57 crypto_stream_.SendHandshakeMessage(message); | 57 // QuicErrorCode and map it to a net error code. |
| 58 return ERR_CONNECTION_FAILED; |
| 59 } |
| 58 | 60 |
| 59 if (IsCryptoHandshakeComplete()) { | 61 if (IsCryptoHandshakeComplete()) { |
| 60 return OK; | 62 return OK; |
| 61 } | 63 } |
| 62 | 64 |
| 63 callback_ = callback; | 65 callback_ = callback; |
| 64 return ERR_IO_PENDING; | 66 return ERR_IO_PENDING; |
| 65 } | 67 } |
| 66 | 68 |
| 67 ReliableQuicStream* QuicClientSession::CreateIncomingReliableStream( | 69 ReliableQuicStream* QuicClientSession::CreateIncomingReliableStream( |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 connection()->ProcessUdpPacket(local_address, peer_address, packet); | 142 connection()->ProcessUdpPacket(local_address, peer_address, packet); |
| 141 if (!connection()->connected()) { | 143 if (!connection()->connected()) { |
| 142 stream_factory_->OnSessionClose(this); | 144 stream_factory_->OnSessionClose(this); |
| 143 return; | 145 return; |
| 144 } | 146 } |
| 145 StartReading(); | 147 StartReading(); |
| 146 } | 148 } |
| 147 } | 149 } |
| 148 | 150 |
| 149 } // namespace net | 151 } // namespace net |
| OLD | NEW |