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 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1105 | 1105 |
1106 // Notify upper layer about channel not writable state, if it was before. | 1106 // Notify upper layer about channel not writable state, if it was before. |
1107 void P2PTransportChannel::HandleNotWritable() { | 1107 void P2PTransportChannel::HandleNotWritable() { |
1108 ASSERT(worker_thread_ == rtc::Thread::Current()); | 1108 ASSERT(worker_thread_ == rtc::Thread::Current()); |
1109 if (was_writable_) { | 1109 if (was_writable_) { |
1110 was_writable_ = false; | 1110 was_writable_ = false; |
1111 set_writable(false); | 1111 set_writable(false); |
1112 } | 1112 } |
1113 } | 1113 } |
1114 | 1114 |
| 1115 // If all connections timed out, delete them all. |
1115 void P2PTransportChannel::HandleAllTimedOut() { | 1116 void P2PTransportChannel::HandleAllTimedOut() { |
1116 // Currently we are treating this as channel not writable. | 1117 for (Connection* connection : connections_) { |
1117 HandleNotWritable(); | 1118 connection->Destroy(); |
| 1119 } |
1118 } | 1120 } |
1119 | 1121 |
1120 bool P2PTransportChannel::weak() const { | 1122 bool P2PTransportChannel::weak() const { |
1121 return !best_connection_ || best_connection_->weak(); | 1123 return !best_connection_ || best_connection_->weak(); |
1122 } | 1124 } |
1123 | 1125 |
1124 // If we have a best connection, return it, otherwise return top one in the | 1126 // If we have a best connection, return it, otherwise return top one in the |
1125 // list (later we will mark it best). | 1127 // list (later we will mark it best). |
1126 Connection* P2PTransportChannel::GetBestConnectionOnNetwork( | 1128 Connection* P2PTransportChannel::GetBestConnectionOnNetwork( |
1127 rtc::Network* network) const { | 1129 rtc::Network* network) const { |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1373 SignalSentPacket(this, sent_packet); | 1375 SignalSentPacket(this, sent_packet); |
1374 } | 1376 } |
1375 | 1377 |
1376 void P2PTransportChannel::OnReadyToSend(Connection* connection) { | 1378 void P2PTransportChannel::OnReadyToSend(Connection* connection) { |
1377 if (connection == best_connection_ && writable()) { | 1379 if (connection == best_connection_ && writable()) { |
1378 SignalReadyToSend(this); | 1380 SignalReadyToSend(this); |
1379 } | 1381 } |
1380 } | 1382 } |
1381 | 1383 |
1382 } // namespace cricket | 1384 } // namespace cricket |
OLD | NEW |