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 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 return false; | 723 return false; |
724 } | 724 } |
725 | 725 |
726 void BasicNetworkManager::StartUpdating() { | 726 void BasicNetworkManager::StartUpdating() { |
727 thread_ = Thread::Current(); | 727 thread_ = Thread::Current(); |
728 if (start_count_) { | 728 if (start_count_) { |
729 // If network interfaces are already discovered and signal is sent, | 729 // If network interfaces are already discovered and signal is sent, |
730 // we should trigger network signal immediately for the new clients | 730 // we should trigger network signal immediately for the new clients |
731 // to start allocating ports. | 731 // to start allocating ports. |
732 if (sent_first_update_) | 732 if (sent_first_update_) |
733 thread_->Post(this, kSignalNetworksMessage); | 733 thread_->Post(RTC_FROM_HERE, this, kSignalNetworksMessage); |
734 } else { | 734 } else { |
735 thread_->Post(this, kUpdateNetworksMessage); | 735 thread_->Post(RTC_FROM_HERE, this, kUpdateNetworksMessage); |
736 StartNetworkMonitor(); | 736 StartNetworkMonitor(); |
737 } | 737 } |
738 ++start_count_; | 738 ++start_count_; |
739 } | 739 } |
740 | 740 |
741 void BasicNetworkManager::StopUpdating() { | 741 void BasicNetworkManager::StopUpdating() { |
742 ASSERT(Thread::Current() == thread_); | 742 ASSERT(Thread::Current() == thread_); |
743 if (!start_count_) | 743 if (!start_count_) |
744 return; | 744 return; |
745 | 745 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 QueryDefaultLocalAddress(AF_INET6)); | 863 QueryDefaultLocalAddress(AF_INET6)); |
864 if (changed || !sent_first_update_) { | 864 if (changed || !sent_first_update_) { |
865 SignalNetworksChanged(); | 865 SignalNetworksChanged(); |
866 sent_first_update_ = true; | 866 sent_first_update_ = true; |
867 } | 867 } |
868 } | 868 } |
869 } | 869 } |
870 | 870 |
871 void BasicNetworkManager::UpdateNetworksContinually() { | 871 void BasicNetworkManager::UpdateNetworksContinually() { |
872 UpdateNetworksOnce(); | 872 UpdateNetworksOnce(); |
873 thread_->PostDelayed(kNetworksUpdateIntervalMs, this, kUpdateNetworksMessage); | 873 thread_->PostDelayed(RTC_FROM_HERE, kNetworksUpdateIntervalMs, this, |
| 874 kUpdateNetworksMessage); |
874 } | 875 } |
875 | 876 |
876 void BasicNetworkManager::DumpNetworks() { | 877 void BasicNetworkManager::DumpNetworks() { |
877 NetworkList list; | 878 NetworkList list; |
878 GetNetworks(&list); | 879 GetNetworks(&list); |
879 LOG(LS_INFO) << "NetworkManager detected " << list.size() << " networks:"; | 880 LOG(LS_INFO) << "NetworkManager detected " << list.size() << " networks:"; |
880 for (const Network* network : list) { | 881 for (const Network* network : list) { |
881 LOG(LS_INFO) << network->ToString() << ": " << network->description() | 882 LOG(LS_INFO) << network->ToString() << ": " << network->description() |
882 << ", active ? " << network->active() | 883 << ", active ? " << network->active() |
883 << ((network->ignored()) ? ", Ignored" : ""); | 884 << ((network->ignored()) ? ", Ignored" : ""); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 std::stringstream ss; | 977 std::stringstream ss; |
977 // Print out the first space-terminated token of the network desc, plus | 978 // Print out the first space-terminated token of the network desc, plus |
978 // the IP address. | 979 // the IP address. |
979 ss << "Net[" << description_.substr(0, description_.find(' ')) | 980 ss << "Net[" << description_.substr(0, description_.find(' ')) |
980 << ":" << prefix_.ToSensitiveString() << "/" << prefix_length_ | 981 << ":" << prefix_.ToSensitiveString() << "/" << prefix_length_ |
981 << ":" << AdapterTypeToString(type_) << "]"; | 982 << ":" << AdapterTypeToString(type_) << "]"; |
982 return ss.str(); | 983 return ss.str(); |
983 } | 984 } |
984 | 985 |
985 } // namespace rtc | 986 } // namespace rtc |
OLD | NEW |