| 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/tools/quic/quic_client.h" | 5 #include "net/tools/quic/quic_client.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <netinet/in.h> | 8 #include <netinet/in.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 #include <sys/epoll.h> | 10 #include <sys/epoll.h> |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 bool QuicClient::StartConnect() { | 176 bool QuicClient::StartConnect() { |
| 177 DCHECK(initialized_); | 177 DCHECK(initialized_); |
| 178 DCHECK(!connected()); | 178 DCHECK(!connected()); |
| 179 | 179 |
| 180 QuicPacketWriter* writer = CreateQuicPacketWriter(); | 180 QuicPacketWriter* writer = CreateQuicPacketWriter(); |
| 181 if (writer_.get() != writer) { | 181 if (writer_.get() != writer) { |
| 182 writer_.reset(writer); | 182 writer_.reset(writer); |
| 183 } | 183 } |
| 184 | 184 |
| 185 session_.reset(new QuicClientSession( | 185 session_.reset(new QuicClientSession( |
| 186 server_id_, | |
| 187 config_, | 186 config_, |
| 188 new QuicConnection(GenerateConnectionId(), server_address_, helper_.get(), | 187 new QuicConnection(GenerateConnectionId(), server_address_, helper_.get(), |
| 189 writer_.get(), false, supported_versions_), | 188 writer_.get(), false, supported_versions_))); |
| 190 &crypto_config_)); | 189 session_->InitializeSession(server_id_, &crypto_config_); |
| 191 return session_->CryptoConnect(); | 190 return session_->CryptoConnect(); |
| 192 } | 191 } |
| 193 | 192 |
| 194 bool QuicClient::EncryptionBeingEstablished() { | 193 bool QuicClient::EncryptionBeingEstablished() { |
| 195 return !session_->IsEncryptionEstablished() && | 194 return !session_->IsEncryptionEstablished() && |
| 196 session_->connection()->connected(); | 195 session_->connection()->connected(); |
| 197 } | 196 } |
| 198 | 197 |
| 199 void QuicClient::Disconnect() { | 198 void QuicClient::Disconnect() { |
| 200 DCHECK(initialized_); | 199 DCHECK(initialized_); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 QuicEncryptedPacket packet(buf, bytes_read, false); | 334 QuicEncryptedPacket packet(buf, bytes_read, false); |
| 336 | 335 |
| 337 IPEndPoint client_address(client_ip, client_address_.port()); | 336 IPEndPoint client_address(client_ip, client_address_.port()); |
| 338 session_->connection()->ProcessUdpPacket( | 337 session_->connection()->ProcessUdpPacket( |
| 339 client_address, server_address, packet); | 338 client_address, server_address, packet); |
| 340 return true; | 339 return true; |
| 341 } | 340 } |
| 342 | 341 |
| 343 } // namespace tools | 342 } // namespace tools |
| 344 } // namespace net | 343 } // namespace net |
| OLD | NEW |