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

Side by Side Diff: webrtc/base/network.cc

Issue 1592763003: fix bug 5430 (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Fix ipv6 test failure. Created 4 years, 11 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 | « no previous file | webrtc/base/network_unittest.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 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 } 764 }
765 765
766 IPAddress BasicNetworkManager::QueryDefaultLocalAddress(int family) const { 766 IPAddress BasicNetworkManager::QueryDefaultLocalAddress(int family) const {
767 ASSERT(thread_ == Thread::Current()); 767 ASSERT(thread_ == Thread::Current());
768 ASSERT(thread_->socketserver() != nullptr); 768 ASSERT(thread_->socketserver() != nullptr);
769 ASSERT(family == AF_INET || family == AF_INET6); 769 ASSERT(family == AF_INET || family == AF_INET6);
770 770
771 scoped_ptr<AsyncSocket> socket( 771 scoped_ptr<AsyncSocket> socket(
772 thread_->socketserver()->CreateAsyncSocket(family, SOCK_DGRAM)); 772 thread_->socketserver()->CreateAsyncSocket(family, SOCK_DGRAM));
773 if (!socket) { 773 if (!socket) {
774 LOG_ERR(LERROR) << "Socket creation failed";
774 return IPAddress(); 775 return IPAddress();
775 } 776 }
776 777
777 if (!socket->Connect( 778 if (socket->Connect(SocketAddress(
778 SocketAddress(family == AF_INET ? kPublicIPv4Host : kPublicIPv6Host, 779 family == AF_INET ? kPublicIPv4Host : kPublicIPv6Host, kPublicPort)) <
779 kPublicPort))) { 780 0) {
781 LOG_ERR(LERROR) << "Connect failed with " << socket->GetError();
780 return IPAddress(); 782 return IPAddress();
781 } 783 }
782 return socket->GetLocalAddress().ipaddr(); 784 return socket->GetLocalAddress().ipaddr();
783 } 785 }
784 786
785 void BasicNetworkManager::UpdateNetworksOnce() { 787 void BasicNetworkManager::UpdateNetworksOnce() {
786 if (!start_count_) 788 if (!start_count_)
787 return; 789 return;
788 790
789 ASSERT(Thread::Current() == thread_); 791 ASSERT(Thread::Current() == thread_);
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 std::stringstream ss; 914 std::stringstream ss;
913 // Print out the first space-terminated token of the network desc, plus 915 // Print out the first space-terminated token of the network desc, plus
914 // the IP address. 916 // the IP address.
915 ss << "Net[" << description_.substr(0, description_.find(' ')) 917 ss << "Net[" << description_.substr(0, description_.find(' '))
916 << ":" << prefix_.ToSensitiveString() << "/" << prefix_length_ 918 << ":" << prefix_.ToSensitiveString() << "/" << prefix_length_
917 << ":" << AdapterTypeToString(type_) << "]"; 919 << ":" << AdapterTypeToString(type_) << "]";
918 return ss.str(); 920 return ss.str();
919 } 921 }
920 922
921 } // namespace rtc 923 } // namespace rtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/base/network_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698