| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 DCHECK(!connected()); | 157 DCHECK(!connected()); |
| 158 | 158 |
| 159 QuicPacketWriter* writer = CreateQuicPacketWriter(); | 159 QuicPacketWriter* writer = CreateQuicPacketWriter(); |
| 160 if (writer_.get() != writer) { | 160 if (writer_.get() != writer) { |
| 161 writer_.reset(writer); | 161 writer_.reset(writer); |
| 162 } | 162 } |
| 163 | 163 |
| 164 session_.reset(new QuicClientSession( | 164 session_.reset(new QuicClientSession( |
| 165 server_hostname_, | 165 server_hostname_, |
| 166 config_, | 166 config_, |
| 167 new QuicConnection(GenerateGuid(), server_address_, helper_.get(), | 167 new QuicConnection(GenerateConnectionId(), server_address_, helper_.get(), |
| 168 writer_.get(), false, supported_versions_), | 168 writer_.get(), false, supported_versions_), |
| 169 &crypto_config_)); | 169 &crypto_config_)); |
| 170 return session_->CryptoConnect(); | 170 return session_->CryptoConnect(); |
| 171 } | 171 } |
| 172 | 172 |
| 173 bool QuicClient::EncryptionBeingEstablished() { | 173 bool QuicClient::EncryptionBeingEstablished() { |
| 174 return !session_->IsEncryptionEstablished() && | 174 return !session_->IsEncryptionEstablished() && |
| 175 session_->connection()->connected(); | 175 session_->connection()->connected(); |
| 176 } | 176 } |
| 177 | 177 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 return NULL; | 275 return NULL; |
| 276 } | 276 } |
| 277 return session_->options(); | 277 return session_->options(); |
| 278 } | 278 } |
| 279 | 279 |
| 280 bool QuicClient::connected() const { | 280 bool QuicClient::connected() const { |
| 281 return session_.get() && session_->connection() && | 281 return session_.get() && session_->connection() && |
| 282 session_->connection()->connected(); | 282 session_->connection()->connected(); |
| 283 } | 283 } |
| 284 | 284 |
| 285 QuicGuid QuicClient::GenerateGuid() { | 285 QuicConnectionId QuicClient::GenerateConnectionId() { |
| 286 return QuicRandom::GetInstance()->RandUint64(); | 286 return QuicRandom::GetInstance()->RandUint64(); |
| 287 } | 287 } |
| 288 | 288 |
| 289 QuicEpollConnectionHelper* QuicClient::CreateQuicConnectionHelper() { | 289 QuicEpollConnectionHelper* QuicClient::CreateQuicConnectionHelper() { |
| 290 return new QuicEpollConnectionHelper(&epoll_server_); | 290 return new QuicEpollConnectionHelper(&epoll_server_); |
| 291 } | 291 } |
| 292 | 292 |
| 293 QuicPacketWriter* QuicClient::CreateQuicPacketWriter() { | 293 QuicPacketWriter* QuicClient::CreateQuicPacketWriter() { |
| 294 return new QuicDefaultPacketWriter(fd_); | 294 return new QuicDefaultPacketWriter(fd_); |
| 295 } | 295 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 313 QuicEncryptedPacket packet(buf, bytes_read, false); | 313 QuicEncryptedPacket packet(buf, bytes_read, false); |
| 314 | 314 |
| 315 IPEndPoint client_address(client_ip, client_address_.port()); | 315 IPEndPoint client_address(client_ip, client_address_.port()); |
| 316 session_->connection()->ProcessUdpPacket( | 316 session_->connection()->ProcessUdpPacket( |
| 317 client_address, server_address, packet); | 317 client_address, server_address, packet); |
| 318 return true; | 318 return true; |
| 319 } | 319 } |
| 320 | 320 |
| 321 } // namespace tools | 321 } // namespace tools |
| 322 } // namespace net | 322 } // namespace net |
| OLD | NEW |