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 25 matching lines...) Expand all Loading... |
36 local_port_(0), | 36 local_port_(0), |
37 fd_(-1), | 37 fd_(-1), |
38 initialized_(false), | 38 initialized_(false), |
39 packets_dropped_(0), | 39 packets_dropped_(0), |
40 overflow_supported_(false) { | 40 overflow_supported_(false) { |
41 epoll_server_.set_timeout_in_us(50 * 1000); | 41 epoll_server_.set_timeout_in_us(50 * 1000); |
42 } | 42 } |
43 | 43 |
44 QuicClient::~QuicClient() { | 44 QuicClient::~QuicClient() { |
45 if (connected()) { | 45 if (connected()) { |
46 session()->connection()->SendConnectionClosePacket( | 46 session()->connection() |
47 QUIC_PEER_GOING_AWAY, ""); | 47 ->SendConnectionClosePacket(QUIC_PEER_GOING_AWAY, std::string()); |
48 } | 48 } |
49 } | 49 } |
50 | 50 |
51 bool QuicClient::Initialize() { | 51 bool QuicClient::Initialize() { |
52 int address_family = server_address_.GetSockAddrFamily(); | 52 int address_family = server_address_.GetSockAddrFamily(); |
53 fd_ = socket(address_family, SOCK_DGRAM | SOCK_NONBLOCK, IPPROTO_UDP); | 53 fd_ = socket(address_family, SOCK_DGRAM | SOCK_NONBLOCK, IPPROTO_UDP); |
54 if (fd_ < 0) { | 54 if (fd_ < 0) { |
55 LOG(ERROR) << "CreateSocket() failed: " << strerror(errno); | 55 LOG(ERROR) << "CreateSocket() failed: " << strerror(errno); |
56 return false; | 56 return false; |
57 } | 57 } |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 } | 239 } |
240 | 240 |
241 IPEndPoint client_address(client_ip, client_address_.port()); | 241 IPEndPoint client_address(client_ip, client_address_.port()); |
242 session_->connection()->ProcessUdpPacket( | 242 session_->connection()->ProcessUdpPacket( |
243 client_address, server_address, packet); | 243 client_address, server_address, packet); |
244 return true; | 244 return true; |
245 } | 245 } |
246 | 246 |
247 } // namespace tools | 247 } // namespace tools |
248 } // namespace net | 248 } // namespace net |
OLD | NEW |