Index: webrtc/base/fakenetwork.h |
diff --git a/webrtc/base/fakenetwork.h b/webrtc/base/fakenetwork.h |
index 065d08d4c19c8f32f380a7ce8304fa6f599cff59..4b6bb68a96d9450bc82330534ae05cea0861d081 100644 |
--- a/webrtc/base/fakenetwork.h |
+++ b/webrtc/base/fakenetwork.h |
@@ -29,7 +29,12 @@ |
class FakeNetworkManager : public NetworkManagerBase, |
public MessageHandler { |
public: |
- FakeNetworkManager() : thread_(Thread::Current()) {} |
+ FakeNetworkManager() |
+ : thread_(Thread::Current()), |
+ next_index_(0), |
+ started_(false), |
+ sent_first_update_(false) { |
+ } |
typedef std::vector<SocketAddress> IfaceList; |
@@ -53,18 +58,20 @@ |
} |
virtual void StartUpdating() { |
- ++start_count_; |
- if (start_count_ == 1) { |
- sent_first_update_ = false; |
- thread_->Post(this); |
- } else { |
- if (sent_first_update_) { |
+ if (started_) { |
+ if (sent_first_update_) |
SignalNetworksChanged(); |
- } |
+ return; |
} |
+ |
+ started_ = true; |
+ sent_first_update_ = false; |
+ thread_->Post(this); |
} |
- virtual void StopUpdating() { --start_count_; } |
+ virtual void StopUpdating() { |
+ started_ = false; |
+ } |
// MessageHandler interface. |
virtual void OnMessage(Message* msg) { |
@@ -75,7 +82,7 @@ |
private: |
void DoUpdateNetworks() { |
- if (start_count_ == 0) |
+ if (!started_) |
return; |
std::vector<Network*> networks; |
for (IfaceList::iterator it = ifaces_.begin(); |
@@ -104,9 +111,9 @@ |
Thread* thread_; |
IfaceList ifaces_; |
- int next_index_ = 0; |
- int start_count_ = 0; |
- bool sent_first_update_ = false; |
+ int next_index_; |
+ bool started_; |
+ bool sent_first_update_; |
}; |
} // namespace rtc |