| 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 bool QuicClient::StartConnect() { | 184 bool QuicClient::StartConnect() { |
| 185 DCHECK(initialized_); | 185 DCHECK(initialized_); |
| 186 DCHECK(!connected()); | 186 DCHECK(!connected()); |
| 187 | 187 |
| 188 QuicPacketWriter* writer = CreateQuicPacketWriter(); | 188 QuicPacketWriter* writer = CreateQuicPacketWriter(); |
| 189 if (writer_.get() != writer) { | 189 if (writer_.get() != writer) { |
| 190 writer_.reset(writer); | 190 writer_.reset(writer); |
| 191 } | 191 } |
| 192 | 192 |
| 193 session_.reset(new QuicClientSession( | 193 session_.reset(new QuicClientSession( |
| 194 server_id_, | |
| 195 config_, | 194 config_, |
| 196 new QuicConnection(GenerateConnectionId(), server_address_, helper_.get(), | 195 new QuicConnection(GenerateConnectionId(), server_address_, helper_.get(), |
| 197 writer_.get(), false, supported_versions_), | 196 writer_.get(), false, supported_versions_))); |
| 198 &crypto_config_)); | 197 session_->InitializeSession(server_id_, &crypto_config_); |
| 199 return session_->CryptoConnect(); | 198 return session_->CryptoConnect(); |
| 200 } | 199 } |
| 201 | 200 |
| 202 bool QuicClient::EncryptionBeingEstablished() { | 201 bool QuicClient::EncryptionBeingEstablished() { |
| 203 return !session_->IsEncryptionEstablished() && | 202 return !session_->IsEncryptionEstablished() && |
| 204 session_->connection()->connected(); | 203 session_->connection()->connected(); |
| 205 } | 204 } |
| 206 | 205 |
| 207 void QuicClient::Disconnect() { | 206 void QuicClient::Disconnect() { |
| 208 DCHECK(initialized_); | 207 DCHECK(initialized_); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 QuicEncryptedPacket packet(buf, bytes_read, false); | 342 QuicEncryptedPacket packet(buf, bytes_read, false); |
| 344 | 343 |
| 345 IPEndPoint client_address(client_ip, client_address_.port()); | 344 IPEndPoint client_address(client_ip, client_address_.port()); |
| 346 session_->connection()->ProcessUdpPacket( | 345 session_->connection()->ProcessUdpPacket( |
| 347 client_address, server_address, packet); | 346 client_address, server_address, packet); |
| 348 return true; | 347 return true; |
| 349 } | 348 } |
| 350 | 349 |
| 351 } // namespace tools | 350 } // namespace tools |
| 352 } // namespace net | 351 } // namespace net |
| OLD | NEW |