| 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 "net/base/io_buffer.h" | 9 #include "net/base/io_buffer.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 ActivateStream(stream); | 47 ActivateStream(stream); |
| 48 return stream; | 48 return stream; |
| 49 } | 49 } |
| 50 | 50 |
| 51 QuicCryptoClientStream* QuicClientSession::GetCryptoStream() { | 51 QuicCryptoClientStream* QuicClientSession::GetCryptoStream() { |
| 52 return &crypto_stream_; | 52 return &crypto_stream_; |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 int QuicClientSession::CryptoConnect(const CompletionCallback& callback) { | 55 int QuicClientSession::CryptoConnect(const CompletionCallback& callback) { |
| 56 CryptoHandshakeMessage message; | 56 if (!crypto_stream_.CryptoConnect()) { |
| 57 message.tag = kCHLO; | 57 // TODO(wtc): change crypto_stream_.CryptoConnect() to return a |
| 58 crypto_stream_.SendHandshakeMessage(message); | 58 // QuicErrorCode and map it to a net error code. |
| 59 return ERR_CONNECTION_FAILED; |
| 60 } |
| 59 | 61 |
| 60 if (IsCryptoHandshakeComplete()) { | 62 if (IsCryptoHandshakeComplete()) { |
| 61 return OK; | 63 return OK; |
| 62 } | 64 } |
| 63 | 65 |
| 64 callback_ = callback; | 66 callback_ = callback; |
| 65 return ERR_IO_PENDING; | 67 return ERR_IO_PENDING; |
| 66 } | 68 } |
| 67 | 69 |
| 68 ReliableQuicStream* QuicClientSession::CreateIncomingReliableStream( | 70 ReliableQuicStream* QuicClientSession::CreateIncomingReliableStream( |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 connection()->ProcessUdpPacket(local_address, peer_address, packet); | 132 connection()->ProcessUdpPacket(local_address, peer_address, packet); |
| 131 if (!connection()->connected()) { | 133 if (!connection()->connected()) { |
| 132 stream_factory_->OnSessionClose(this); | 134 stream_factory_->OnSessionClose(this); |
| 133 return; | 135 return; |
| 134 } | 136 } |
| 135 StartReading(); | 137 StartReading(); |
| 136 } | 138 } |
| 137 } | 139 } |
| 138 | 140 |
| 139 } // namespace net | 141 } // namespace net |
| OLD | NEW |