| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 server_id_(server_id), | 42 server_id_(server_id), |
| 43 local_port_(0), | 43 local_port_(0), |
| 44 epoll_server_(epoll_server), | 44 epoll_server_(epoll_server), |
| 45 fd_(-1), | 45 fd_(-1), |
| 46 helper_(CreateQuicConnectionHelper()), | 46 helper_(CreateQuicConnectionHelper()), |
| 47 initialized_(false), | 47 initialized_(false), |
| 48 packets_dropped_(0), | 48 packets_dropped_(0), |
| 49 overflow_supported_(false), | 49 overflow_supported_(false), |
| 50 supported_versions_(supported_versions), | 50 supported_versions_(supported_versions), |
| 51 print_response_(print_response) { | 51 print_response_(print_response) { |
| 52 config_.SetDefaults(); | |
| 53 } | 52 } |
| 54 | 53 |
| 55 QuicClient::QuicClient(IPEndPoint server_address, | 54 QuicClient::QuicClient(IPEndPoint server_address, |
| 56 const QuicServerId& server_id, | 55 const QuicServerId& server_id, |
| 57 const QuicVersionVector& supported_versions, | 56 const QuicVersionVector& supported_versions, |
| 58 bool print_response, | 57 bool print_response, |
| 59 const QuicConfig& config, | 58 const QuicConfig& config, |
| 60 EpollServer* epoll_server) | 59 EpollServer* epoll_server) |
| 61 : server_address_(server_address), | 60 : server_address_(server_address), |
| 62 server_id_(server_id), | 61 server_id_(server_id), |
| (...skipping 16 matching lines...) Expand all Loading... |
| 79 } | 78 } |
| 80 if (fd_ > 0) { | 79 if (fd_ > 0) { |
| 81 epoll_server_->UnregisterFD(fd_); | 80 epoll_server_->UnregisterFD(fd_); |
| 82 } | 81 } |
| 83 } | 82 } |
| 84 | 83 |
| 85 bool QuicClient::Initialize() { | 84 bool QuicClient::Initialize() { |
| 86 DCHECK(!initialized_); | 85 DCHECK(!initialized_); |
| 87 | 86 |
| 88 epoll_server_->set_timeout_in_us(50 * 1000); | 87 epoll_server_->set_timeout_in_us(50 * 1000); |
| 89 crypto_config_.SetDefaults(); | |
| 90 | 88 |
| 91 if (!CreateUDPSocket()) { | 89 if (!CreateUDPSocket()) { |
| 92 return false; | 90 return false; |
| 93 } | 91 } |
| 94 | 92 |
| 95 epoll_server_->RegisterFD(fd_, this, kEpollFlags); | 93 epoll_server_->RegisterFD(fd_, this, kEpollFlags); |
| 96 initialized_ = true; | 94 initialized_ = true; |
| 97 return true; | 95 return true; |
| 98 } | 96 } |
| 99 | 97 |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 QuicEncryptedPacket packet(buf, bytes_read, false); | 355 QuicEncryptedPacket packet(buf, bytes_read, false); |
| 358 | 356 |
| 359 IPEndPoint client_address(client_ip, client_address_.port()); | 357 IPEndPoint client_address(client_ip, client_address_.port()); |
| 360 session_->connection()->ProcessUdpPacket( | 358 session_->connection()->ProcessUdpPacket( |
| 361 client_address, server_address, packet); | 359 client_address, server_address, packet); |
| 362 return true; | 360 return true; |
| 363 } | 361 } |
| 364 | 362 |
| 365 } // namespace tools | 363 } // namespace tools |
| 366 } // namespace net | 364 } // namespace net |
| OLD | NEW |