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

Unified Diff: net/tools/quic/quic_socket_utils.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 side-by-side diff with in-line comments
Download patch
« net/tools/quic/quic_server.cc ('K') | « net/tools/quic/quic_server.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/quic/quic_socket_utils.cc
diff --git a/net/tools/quic/quic_socket_utils.cc b/net/tools/quic/quic_socket_utils.cc
index 3202150917bbb55c9d21a5b1d0ab94e7d6bef29c..f635515a3cf651cf212308b22c052ff2c5126cb9 100644
--- a/net/tools/quic/quic_socket_utils.cc
+++ b/net/tools/quic/quic_socket_utils.cc
@@ -70,13 +70,13 @@ bool QuicSocketUtils::GetOverflowFromMsghdr(struct msghdr *hdr,
// static
int QuicSocketUtils::SetGetAddressInfo(int fd, int address_family) {
int get_local_ip = 1;
- if (address_family == AF_INET) {
- return setsockopt(fd, IPPROTO_IP, IP_PKTINFO,
- &get_local_ip, sizeof(get_local_ip));
- } else {
- return setsockopt(fd, IPPROTO_IPV6, IPV6_RECVPKTINFO,
+ int rc = setsockopt(fd, IPPROTO_IP, IP_PKTINFO,
&get_local_ip, sizeof(get_local_ip));
+ if (rc == 0 && address_family == AF_INET6) {
+ rc = setsockopt(fd, IPPROTO_IPV6, IPV6_RECVPKTINFO,
+ &get_local_ip, sizeof(get_local_ip));
}
+ return rc;
}
// static
« net/tools/quic/quic_server.cc ('K') | « net/tools/quic/quic_server.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698