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

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

Issue 397793004: Replace setsockopt(IP_PKTINFO) and setsockopt(IPV6_RECVPKTINFO) calls by (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | net/tools/quic/quic_server.cc » ('j') | net/tools/quic/quic_server.cc » ('J')
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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 if (!QuicSocketUtils::SetReceiveBufferSize(fd_, 117 if (!QuicSocketUtils::SetReceiveBufferSize(fd_,
118 TcpReceiver::kReceiveWindowTCP)) { 118 TcpReceiver::kReceiveWindowTCP)) {
119 return false; 119 return false;
120 } 120 }
121 121
122 if (!QuicSocketUtils::SetSendBufferSize(fd_, 122 if (!QuicSocketUtils::SetSendBufferSize(fd_,
123 TcpReceiver::kReceiveWindowTCP)) { 123 TcpReceiver::kReceiveWindowTCP)) {
124 return false; 124 return false;
125 } 125 }
126 126
127 int get_local_ip = 1; 127 rc = QuicSocketUtils::SetGetAddressInfo(fd_, address_family);
128 if (address_family == AF_INET) {
129 rc = setsockopt(fd_, IPPROTO_IP, IP_PKTINFO,
130 &get_local_ip, sizeof(get_local_ip));
131 } else {
132 rc = setsockopt(fd_, IPPROTO_IPV6, IPV6_RECVPKTINFO,
133 &get_local_ip, sizeof(get_local_ip));
134 }
135
136 if (rc < 0) { 128 if (rc < 0) {
137 LOG(ERROR) << "IP detection not supported" << strerror(errno); 129 LOG(ERROR) << "IP detection not supported" << strerror(errno);
138 return false; 130 return false;
139 } 131 }
140 132
141 if (bind_to_address_.size() != 0) { 133 if (bind_to_address_.size() != 0) {
142 client_address_ = IPEndPoint(bind_to_address_, local_port_); 134 client_address_ = IPEndPoint(bind_to_address_, local_port_);
143 } else if (address_family == AF_INET) { 135 } else if (address_family == AF_INET) {
144 IPAddressNumber any4; 136 IPAddressNumber any4;
145 CHECK(net::ParseIPLiteralToNumber("0.0.0.0", &any4)); 137 CHECK(net::ParseIPLiteralToNumber("0.0.0.0", &any4));
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 QuicEncryptedPacket packet(buf, bytes_read, false); 335 QuicEncryptedPacket packet(buf, bytes_read, false);
344 336
345 IPEndPoint client_address(client_ip, client_address_.port()); 337 IPEndPoint client_address(client_ip, client_address_.port());
346 session_->connection()->ProcessUdpPacket( 338 session_->connection()->ProcessUdpPacket(
347 client_address, server_address, packet); 339 client_address, server_address, packet);
348 return true; 340 return true;
349 } 341 }
350 342
351 } // namespace tools 343 } // namespace tools
352 } // namespace net 344 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/tools/quic/quic_server.cc » ('j') | net/tools/quic/quic_server.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698