OLD | NEW |
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 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 return IPAddress(); | 774 return IPAddress(); |
775 } | 775 } |
776 | 776 |
777 if (!socket->Connect( | 777 if (socket->Connect(SocketAddress( |
778 SocketAddress(family == AF_INET ? kPublicIPv4Host : kPublicIPv6Host, | 778 family == AF_INET ? kPublicIPv4Host : kPublicIPv6Host, kPublicPort)) < |
779 kPublicPort))) { | 779 0) { |
780 return IPAddress(); | 780 return IPAddress(); |
781 } | 781 } |
782 return socket->GetLocalAddress().ipaddr(); | 782 return socket->GetLocalAddress().ipaddr(); |
783 } | 783 } |
784 | 784 |
785 void BasicNetworkManager::UpdateNetworksOnce() { | 785 void BasicNetworkManager::UpdateNetworksOnce() { |
786 if (!start_count_) | 786 if (!start_count_) |
787 return; | 787 return; |
788 | 788 |
789 ASSERT(Thread::Current() == thread_); | 789 ASSERT(Thread::Current() == thread_); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 std::stringstream ss; | 912 std::stringstream ss; |
913 // Print out the first space-terminated token of the network desc, plus | 913 // Print out the first space-terminated token of the network desc, plus |
914 // the IP address. | 914 // the IP address. |
915 ss << "Net[" << description_.substr(0, description_.find(' ')) | 915 ss << "Net[" << description_.substr(0, description_.find(' ')) |
916 << ":" << prefix_.ToSensitiveString() << "/" << prefix_length_ | 916 << ":" << prefix_.ToSensitiveString() << "/" << prefix_length_ |
917 << ":" << AdapterTypeToString(type_) << "]"; | 917 << ":" << AdapterTypeToString(type_) << "]"; |
918 return ss.str(); | 918 return ss.str(); |
919 } | 919 } |
920 | 920 |
921 } // namespace rtc | 921 } // namespace rtc |
OLD | NEW |