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

Side by Side Diff: net/tools/quic/quic_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/end_to_end_test.cc ('k') | net/tools/quic/quic_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_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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 int fd = 142 int fd =
143 QuicSocketUtils::CreateUDPSocket(server_address_, &overflow_supported_); 143 QuicSocketUtils::CreateUDPSocket(server_address_, &overflow_supported_);
144 if (fd < 0) { 144 if (fd < 0) {
145 return false; 145 return false;
146 } 146 }
147 147
148 IPEndPoint client_address; 148 IPEndPoint client_address;
149 if (bind_to_address_.size() != 0) { 149 if (bind_to_address_.size() != 0) {
150 client_address = IPEndPoint(bind_to_address_, local_port_); 150 client_address = IPEndPoint(bind_to_address_, local_port_);
151 } else if (server_address_.GetSockAddrFamily() == AF_INET) { 151 } else if (server_address_.GetSockAddrFamily() == AF_INET) {
152 client_address = IPEndPoint(IPAddress(0, 0, 0, 0), local_port_); 152 client_address = IPEndPoint(IPAddress::IPv4AllZeros(), local_port_);
153 } else { 153 } else {
154 IPAddress any6; 154 IPAddress any6 = IPAddress::IPv6AllZeros();
155 CHECK(any6.AssignFromIPLiteral("::"));
156 client_address = IPEndPoint(any6, local_port_); 155 client_address = IPEndPoint(any6, local_port_);
157 } 156 }
158 157
159 sockaddr_storage raw_addr; 158 sockaddr_storage raw_addr;
160 socklen_t raw_addr_len = sizeof(raw_addr); 159 socklen_t raw_addr_len = sizeof(raw_addr);
161 CHECK(client_address.ToSockAddr(reinterpret_cast<sockaddr*>(&raw_addr), 160 CHECK(client_address.ToSockAddr(reinterpret_cast<sockaddr*>(&raw_addr),
162 &raw_addr_len)); 161 &raw_addr_len));
163 int rc = 162 int rc =
164 bind(fd, reinterpret_cast<const sockaddr*>(&raw_addr), sizeof(raw_addr)); 163 bind(fd, reinterpret_cast<const sockaddr*>(&raw_addr), sizeof(raw_addr));
165 if (rc < 0) { 164 if (rc < 0) {
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 return fd_address_map_.back().first; 495 return fd_address_map_.back().first;
497 } 496 }
498 497
499 void QuicClient::ProcessPacket(const IPEndPoint& self_address, 498 void QuicClient::ProcessPacket(const IPEndPoint& self_address,
500 const IPEndPoint& peer_address, 499 const IPEndPoint& peer_address,
501 const QuicEncryptedPacket& packet) { 500 const QuicEncryptedPacket& packet) {
502 session()->connection()->ProcessUdpPacket(self_address, peer_address, packet); 501 session()->connection()->ProcessUdpPacket(self_address, peer_address, packet);
503 } 502 }
504 503
505 } // namespace net 504 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/end_to_end_test.cc ('k') | net/tools/quic/quic_server_bin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698