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()) { |
pthatcher1
2015/09/28 23:34:00
Can you make an early return here?
if (writable()
honghaiz3
2015/09/29 00:04:49
Done.
| |
1074 for (uint32 i = 0; i < allocator_sessions_.size(); ++i) { | 1074 for (uint32 i = 0; i < allocator_sessions_.size(); ++i) { |
1075 if (allocator_sessions_[i]->IsGettingPorts()) { | 1075 PortAllocatorSession* session = allocator_sessions_[i]; |
1076 allocator_sessions_[i]->StopGettingPorts(); | 1076 if (!session->IsGettingPorts()) { |
1077 continue; | |
1078 } | |
1079 // If gathering continually, keep the last session running so that it | |
1080 // will gather candidates if the networks change. | |
1081 if (gather_continually_ && (i + 1 == allocator_sessions_.size())) { | |
1082 session->ClearGettingPorts(); | |
1083 } else { | |
1084 session->StopGettingPorts(); | |
1077 } | 1085 } |
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
| |
1078 } | 1086 } |
1079 } | 1087 } |
1080 | 1088 |
1081 was_writable_ = true; | 1089 was_writable_ = true; |
1082 set_writable(true); | 1090 set_writable(true); |
1083 } | 1091 } |
1084 | 1092 |
1085 // Notify upper layer about channel not writable state, if it was before. | 1093 // Notify upper layer about channel not writable state, if it was before. |
1086 void P2PTransportChannel::HandleNotWritable() { | 1094 void P2PTransportChannel::HandleNotWritable() { |
1087 ASSERT(worker_thread_ == rtc::Thread::Current()); | 1095 ASSERT(worker_thread_ == rtc::Thread::Current()); |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1345 } | 1353 } |
1346 } | 1354 } |
1347 | 1355 |
1348 void P2PTransportChannel::OnReadyToSend(Connection* connection) { | 1356 void P2PTransportChannel::OnReadyToSend(Connection* connection) { |
1349 if (connection == best_connection_ && writable()) { | 1357 if (connection == best_connection_ && writable()) { |
1350 SignalReadyToSend(this); | 1358 SignalReadyToSend(this); |
1351 } | 1359 } |
1352 } | 1360 } |
1353 | 1361 |
1354 } // namespace cricket | 1362 } // namespace cricket |
OLD | NEW |