Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(336)

Side by Side Diff: net/tools/quic/quic_simple_client.cc

Issue 1809863002: Update some callers to use more direct ways of constructing IPAddress from well known literals. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rch feedbak Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/tools/quic/quic_server_bin.cc ('k') | net/tools/quic/quic_simple_server_bin.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/logging.h" 7 #include "base/logging.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/thread_task_runner_handle.h" 9 #include "base/thread_task_runner_handle.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 100
101 bool QuicSimpleClient::CreateUDPSocket() { 101 bool QuicSimpleClient::CreateUDPSocket() {
102 scoped_ptr<UDPClientSocket> socket( 102 scoped_ptr<UDPClientSocket> socket(
103 new UDPClientSocket(DatagramSocket::DEFAULT_BIND, RandIntCallback(), 103 new UDPClientSocket(DatagramSocket::DEFAULT_BIND, RandIntCallback(),
104 &net_log_, NetLog::Source())); 104 &net_log_, NetLog::Source()));
105 105
106 int address_family = server_address_.GetSockAddrFamily(); 106 int address_family = server_address_.GetSockAddrFamily();
107 if (bind_to_address_.size() != 0) { 107 if (bind_to_address_.size() != 0) {
108 client_address_ = IPEndPoint(bind_to_address_, local_port_); 108 client_address_ = IPEndPoint(bind_to_address_, local_port_);
109 } else if (address_family == AF_INET) { 109 } else if (address_family == AF_INET) {
110 client_address_ = IPEndPoint(IPAddress(0, 0, 0, 0), local_port_); 110 client_address_ = IPEndPoint(IPAddress::IPv4AllZeros(), local_port_);
111 } else { 111 } else {
112 IPAddress any6; 112 client_address_ = IPEndPoint(IPAddress::IPv6AllZeros(), local_port_);
113 CHECK(any6.AssignFromIPLiteral("::"));
114 client_address_ = IPEndPoint(any6, local_port_);
115 } 113 }
116 114
117 int rc = socket->Connect(server_address_); 115 int rc = socket->Connect(server_address_);
118 if (rc != OK) { 116 if (rc != OK) {
119 LOG(ERROR) << "Connect failed: " << ErrorToShortString(rc); 117 LOG(ERROR) << "Connect failed: " << ErrorToShortString(rc);
120 return false; 118 return false;
121 } 119 }
122 120
123 rc = socket->SetReceiveBufferSize(kDefaultSocketReceiveBuffer); 121 rc = socket->SetReceiveBufferSize(kDefaultSocketReceiveBuffer);
124 if (rc != OK) { 122 if (rc != OK) {
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 session()->connection()->ProcessUdpPacket(local_address, peer_address, 394 session()->connection()->ProcessUdpPacket(local_address, peer_address,
397 packet); 395 packet);
398 if (!session()->connection()->connected()) { 396 if (!session()->connection()->connected()) {
399 return false; 397 return false;
400 } 398 }
401 399
402 return true; 400 return true;
403 } 401 }
404 402
405 } // namespace net 403 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_server_bin.cc ('k') | net/tools/quic/quic_simple_server_bin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698