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

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

Issue 1556743002: Bind a socket to a network if the network handle is set. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: 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 | « talk/app/webrtc/java/jni/peerconnection_jni.cc ('k') | 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 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 sent_first_update_ = false; 724 sent_first_update_ = false;
725 StopNetworkMonitor(); 725 StopNetworkMonitor();
726 } 726 }
727 } 727 }
728 728
729 void BasicNetworkManager::StartNetworkMonitor() { 729 void BasicNetworkManager::StartNetworkMonitor() {
730 NetworkMonitorFactory* factory = NetworkMonitorFactory::GetFactory(); 730 NetworkMonitorFactory* factory = NetworkMonitorFactory::GetFactory();
731 if (factory == nullptr) { 731 if (factory == nullptr) {
732 return; 732 return;
733 } 733 }
734 network_monitor_.reset(factory->CreateNetworkMonitor());
735 if (!network_monitor_) { 734 if (!network_monitor_) {
736 return; 735 network_monitor_.reset(factory->CreateNetworkMonitor());
736 if (!network_monitor_) {
737 return;
738 }
737 } 739 }
740
738 network_monitor_->SignalNetworksChanged.connect( 741 network_monitor_->SignalNetworksChanged.connect(
739 this, &BasicNetworkManager::OnNetworksChanged); 742 this, &BasicNetworkManager::OnNetworksChanged);
740 network_monitor_->Start(); 743 network_monitor_->Start();
741 } 744 }
742 745
743 void BasicNetworkManager::StopNetworkMonitor() { 746 void BasicNetworkManager::StopNetworkMonitor() {
744 if (!network_monitor_) { 747 if (!network_monitor_) {
745 return; 748 return;
746 } 749 }
747 network_monitor_->Stop(); 750 network_monitor_->Stop();
748 network_monitor_.reset();
749 } 751 }
750 752
751 void BasicNetworkManager::OnMessage(Message* msg) { 753 void BasicNetworkManager::OnMessage(Message* msg) {
752 switch (msg->message_id) { 754 switch (msg->message_id) {
753 case kUpdateNetworksMessage: { 755 case kUpdateNetworksMessage: {
754 UpdateNetworksContinually(); 756 UpdateNetworksContinually();
755 break; 757 break;
756 } 758 }
757 case kSignalNetworksMessage: { 759 case kSignalNetworksMessage: {
758 SignalNetworksChanged(); 760 SignalNetworksChanged();
(...skipping 153 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 | « talk/app/webrtc/java/jni/peerconnection_jni.cc ('k') | webrtc/base/network_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698