Index: webrtc/p2p/base/p2ptransportchannel.cc |
diff --git a/webrtc/p2p/base/p2ptransportchannel.cc b/webrtc/p2p/base/p2ptransportchannel.cc |
index 66532411b29f5241c6b0f163d87c91d7ba9cbe2a..9b0cfadc289a7f5eed07ebc57146c4c637936c8d 100644 |
--- a/webrtc/p2p/base/p2ptransportchannel.cc |
+++ b/webrtc/p2p/base/p2ptransportchannel.cc |
@@ -1400,10 +1400,14 @@ void P2PTransportChannel::OnConnectionStateChange(Connection* connection) { |
} |
// May stop the allocator session when at least one connection becomes |
- // strongly connected after starting to get ports. It is not enough to check |
+ // strongly connected after starting to get ports and the local candidate of |
+ // the connection is at the latest generation. It is not enough to check |
// that the connection becomes weakly connected because the connection may be |
// changing from (writable, receiving) to (writable, not receiving). |
- if (!connection->weak()) { |
+ bool strongly_connected = !connection->weak(); |
+ bool latest_generation = connection->local_candidate().generation() >= |
+ allocator_session()->generation(); |
+ if (strongly_connected && latest_generation) { |
MaybeStopPortAllocatorSessions(); |
} |