OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1063 break; | 1063 break; |
1064 } | 1064 } |
1065 } | 1065 } |
1066 set_receiving(receiving); | 1066 set_receiving(receiving); |
1067 } | 1067 } |
1068 | 1068 |
1069 // We checked the status of our connections and we had at least one that | 1069 // We checked the status of our connections and we had at least one that |
1070 // was writable, go into the writable state. | 1070 // was writable, go into the writable state. |
1071 void P2PTransportChannel::HandleWritable() { | 1071 void P2PTransportChannel::HandleWritable() { |
1072 ASSERT(worker_thread_ == rtc::Thread::Current()); | 1072 ASSERT(worker_thread_ == rtc::Thread::Current()); |
1073 if (!writable()) { | 1073 if (writable()) { |
1074 for (uint32 i = 0; i < allocator_sessions_.size(); ++i) { | 1074 return; |
1075 if (allocator_sessions_[i]->IsGettingPorts()) { | 1075 } |
1076 allocator_sessions_[i]->StopGettingPorts(); | 1076 |
1077 } | 1077 for (PortAllocatorSession* session : allocator_sessions_) { |
| 1078 if (!session->IsGettingPorts()) { |
| 1079 continue; |
1078 } | 1080 } |
| 1081 // If gathering continually, keep the last session running so that it |
| 1082 // will gather candidates if the networks change. |
| 1083 if (gather_continually_ && session == allocator_sessions_.back()) { |
| 1084 session->ClearGettingPorts(); |
| 1085 break; |
| 1086 } |
| 1087 session->StopGettingPorts(); |
1079 } | 1088 } |
1080 | 1089 |
1081 was_writable_ = true; | 1090 was_writable_ = true; |
1082 set_writable(true); | 1091 set_writable(true); |
1083 } | 1092 } |
1084 | 1093 |
1085 // Notify upper layer about channel not writable state, if it was before. | 1094 // Notify upper layer about channel not writable state, if it was before. |
1086 void P2PTransportChannel::HandleNotWritable() { | 1095 void P2PTransportChannel::HandleNotWritable() { |
1087 ASSERT(worker_thread_ == rtc::Thread::Current()); | 1096 ASSERT(worker_thread_ == rtc::Thread::Current()); |
1088 if (was_writable_) { | 1097 if (was_writable_) { |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1345 } | 1354 } |
1346 } | 1355 } |
1347 | 1356 |
1348 void P2PTransportChannel::OnReadyToSend(Connection* connection) { | 1357 void P2PTransportChannel::OnReadyToSend(Connection* connection) { |
1349 if (connection == best_connection_ && writable()) { | 1358 if (connection == best_connection_ && writable()) { |
1350 SignalReadyToSend(this); | 1359 SignalReadyToSend(this); |
1351 } | 1360 } |
1352 } | 1361 } |
1353 | 1362 |
1354 } // namespace cricket | 1363 } // namespace cricket |
OLD | NEW |