From 979c268830794316dc1d05ea7242eb7310f6bc23 Mon Sep 17 00:00:00 2001 From: skvlad Date: Fri, 10 Jun 2016 15:24:13 -0700 Subject: [PATCH] Do not reconnect the network change signal each time the network manager is started Due to a bug, the NetworkManager was reconnecting to the NetworkMonitor's NetworkChanged signal every time the network manager is stopped and restarted. After each calls, one more listener was added to the signal and never removed - which caused OnNetworksChanged to be called multiple times on each actual network change. Not sure if this had any negative effect other than the extraneous "Network changed" lines in WebRTC logs, but it wasn't working correctly either way. The fix is to only subscribe to the signal once, when the NetworkMonitor is created. TBR=pthatcher BUG= NOTRY=True Review-Url: https://codereview.webrtc.org/2054583002 Cr-Commit-Position: refs/heads/master@{#13105} --- webrtc/base/network.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/webrtc/base/network.cc b/webrtc/base/network.cc index 5593b6d5ac..36d028b493 100644 --- a/webrtc/base/network.cc +++ b/webrtc/base/network.cc @@ -761,10 +761,9 @@ void BasicNetworkManager::StartNetworkMonitor() { if (!network_monitor_) { return; } + network_monitor_->SignalNetworksChanged.connect( + this, &BasicNetworkManager::OnNetworksChanged); } - - network_monitor_->SignalNetworksChanged.connect( - this, &BasicNetworkManager::OnNetworksChanged); network_monitor_->Start(); }