Chromium Code Reviews| Index: webrtc/p2p/base/p2ptransportchannel.cc |
| diff --git a/webrtc/p2p/base/p2ptransportchannel.cc b/webrtc/p2p/base/p2ptransportchannel.cc |
| index 15ac006872e9087bf8af8cbe1fde783fd29f1160..d1b2330c62e2f386374425153048e4476c7c3edb 100644 |
| --- a/webrtc/p2p/base/p2ptransportchannel.cc |
| +++ b/webrtc/p2p/base/p2ptransportchannel.cc |
| @@ -1072,8 +1072,16 @@ void P2PTransportChannel::HandleWritable() { |
| ASSERT(worker_thread_ == rtc::Thread::Current()); |
| if (!writable()) { |
|
pthatcher1
2015/09/28 23:34:00
Can you make an early return here?
if (writable()
honghaiz3
2015/09/29 00:04:49
Done.
|
| for (uint32 i = 0; i < allocator_sessions_.size(); ++i) { |
| - if (allocator_sessions_[i]->IsGettingPorts()) { |
| - allocator_sessions_[i]->StopGettingPorts(); |
| + PortAllocatorSession* session = allocator_sessions_[i]; |
| + 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_ && (i + 1 == allocator_sessions_.size())) { |
| + session->ClearGettingPorts(); |
| + } else { |
| + session->StopGettingPorts(); |
| } |
|
pthatcher1
2015/09/28 23:34:00
I think this would be more readable like this:
honghaiz3
2015/09/29 00:04:49
Done. Replaced continue with break because that is
|
| } |
| } |