| 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_simple_client.h" | 5 #include "net/tools/quic/quic_simple_client.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| 11 #include "base/threading/thread_task_runner_handle.h" | 11 #include "base/threading/thread_task_runner_handle.h" |
| 12 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
| 13 #include "net/http/http_request_info.h" | 13 #include "net/http/http_request_info.h" |
| 14 #include "net/http/http_response_info.h" | 14 #include "net/http/http_response_info.h" |
| 15 #include "net/log/net_log_source.h" |
| 16 #include "net/log/net_log_with_source.h" |
| 15 #include "net/quic/chromium/quic_chromium_alarm_factory.h" | 17 #include "net/quic/chromium/quic_chromium_alarm_factory.h" |
| 16 #include "net/quic/chromium/quic_chromium_connection_helper.h" | 18 #include "net/quic/chromium/quic_chromium_connection_helper.h" |
| 17 #include "net/quic/chromium/quic_chromium_packet_reader.h" | 19 #include "net/quic/chromium/quic_chromium_packet_reader.h" |
| 18 #include "net/quic/chromium/quic_chromium_packet_writer.h" | 20 #include "net/quic/chromium/quic_chromium_packet_writer.h" |
| 19 #include "net/quic/core/crypto/quic_random.h" | 21 #include "net/quic/core/crypto/quic_random.h" |
| 20 #include "net/quic/core/quic_connection.h" | 22 #include "net/quic/core/quic_connection.h" |
| 21 #include "net/quic/core/quic_flags.h" | 23 #include "net/quic/core/quic_flags.h" |
| 22 #include "net/quic/core/quic_protocol.h" | 24 #include "net/quic/core/quic_protocol.h" |
| 23 #include "net/quic/core/quic_server_id.h" | 25 #include "net/quic/core/quic_server_id.h" |
| 24 #include "net/quic/core/spdy_utils.h" | 26 #include "net/quic/core/spdy_utils.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 if (connected()) { | 67 if (connected()) { |
| 66 session()->connection()->CloseConnection( | 68 session()->connection()->CloseConnection( |
| 67 QUIC_PEER_GOING_AWAY, "Shutting down", | 69 QUIC_PEER_GOING_AWAY, "Shutting down", |
| 68 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); | 70 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); |
| 69 } | 71 } |
| 70 } | 72 } |
| 71 | 73 |
| 72 bool QuicSimpleClient::CreateUDPSocketAndBind() { | 74 bool QuicSimpleClient::CreateUDPSocketAndBind() { |
| 73 std::unique_ptr<UDPClientSocket> socket( | 75 std::unique_ptr<UDPClientSocket> socket( |
| 74 new UDPClientSocket(DatagramSocket::DEFAULT_BIND, RandIntCallback(), | 76 new UDPClientSocket(DatagramSocket::DEFAULT_BIND, RandIntCallback(), |
| 75 &net_log_, NetLog::Source())); | 77 &net_log_, NetLogSource())); |
| 76 | 78 |
| 77 int address_family = server_address().GetSockAddrFamily(); | 79 int address_family = server_address().GetSockAddrFamily(); |
| 78 if (bind_to_address().size() != 0) { | 80 if (bind_to_address().size() != 0) { |
| 79 client_address_ = IPEndPoint(bind_to_address(), local_port()); | 81 client_address_ = IPEndPoint(bind_to_address(), local_port()); |
| 80 } else if (address_family == AF_INET) { | 82 } else if (address_family == AF_INET) { |
| 81 client_address_ = IPEndPoint(IPAddress::IPv4AllZeros(), local_port()); | 83 client_address_ = IPEndPoint(IPAddress::IPv4AllZeros(), local_port()); |
| 82 } else { | 84 } else { |
| 83 client_address_ = IPEndPoint(IPAddress::IPv6AllZeros(), local_port()); | 85 client_address_ = IPEndPoint(IPAddress::IPv6AllZeros(), local_port()); |
| 84 } | 86 } |
| 85 | 87 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 session()->connection()->ProcessUdpPacket(local_address, peer_address, | 198 session()->connection()->ProcessUdpPacket(local_address, peer_address, |
| 197 packet); | 199 packet); |
| 198 if (!session()->connection()->connected()) { | 200 if (!session()->connection()->connected()) { |
| 199 return false; | 201 return false; |
| 200 } | 202 } |
| 201 | 203 |
| 202 return true; | 204 return true; |
| 203 } | 205 } |
| 204 | 206 |
| 205 } // namespace net | 207 } // namespace net |
| OLD | NEW |