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

Unified Diff: webrtc/p2p/base/p2ptransportchannel.cc

Issue 1359363003: Make it possible to keep the port allocator session running (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/p2p/base/p2ptransportchannel_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/base/p2ptransportchannel.cc
diff --git a/webrtc/p2p/base/p2ptransportchannel.cc b/webrtc/p2p/base/p2ptransportchannel.cc
index 15ac006872e9087bf8af8cbe1fde783fd29f1160..cce20f4abb35490923065d7093ad3f0d94f273da 100644
--- a/webrtc/p2p/base/p2ptransportchannel.cc
+++ b/webrtc/p2p/base/p2ptransportchannel.cc
@@ -1070,12 +1070,21 @@ void P2PTransportChannel::UpdateChannelState() {
// was writable, go into the writable state.
void P2PTransportChannel::HandleWritable() {
ASSERT(worker_thread_ == rtc::Thread::Current());
- if (!writable()) {
- for (uint32 i = 0; i < allocator_sessions_.size(); ++i) {
- if (allocator_sessions_[i]->IsGettingPorts()) {
- allocator_sessions_[i]->StopGettingPorts();
- }
+ if (writable()) {
+ return;
+ }
+
+ for (PortAllocatorSession* session : allocator_sessions_) {
+ if (!session->IsGettingPorts()) {
+ continue;
+ }
+ // If gathering continually, keep the last session running so that it
+ // will gather candidates if the networks change.
+ if (gather_continually_ && session == allocator_sessions_.back()) {
+ session->ClearGettingPorts();
+ break;
}
+ session->StopGettingPorts();
}
was_writable_ = true;
« no previous file with comments | « no previous file | webrtc/p2p/base/p2ptransportchannel_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698