| 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 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 976 ASSERT(worker_thread_ == rtc::Thread::Current()); | 976 ASSERT(worker_thread_ == rtc::Thread::Current()); |
| 977 if (flags != 0) { | 977 if (flags != 0) { |
| 978 error_ = EINVAL; | 978 error_ = EINVAL; |
| 979 return -1; | 979 return -1; |
| 980 } | 980 } |
| 981 if (best_connection_ == NULL) { | 981 if (best_connection_ == NULL) { |
| 982 error_ = EWOULDBLOCK; | 982 error_ = EWOULDBLOCK; |
| 983 return -1; | 983 return -1; |
| 984 } | 984 } |
| 985 | 985 |
| 986 last_sent_packet_id_ = options.packet_id; |
| 986 int sent = best_connection_->Send(data, len, options); | 987 int sent = best_connection_->Send(data, len, options); |
| 987 if (sent <= 0) { | 988 if (sent <= 0) { |
| 988 ASSERT(sent < 0); | 989 ASSERT(sent < 0); |
| 989 error_ = best_connection_->GetError(); | 990 error_ = best_connection_->GetError(); |
| 990 } | 991 } |
| 991 return sent; | 992 return sent; |
| 992 } | 993 } |
| 993 | 994 |
| 994 bool P2PTransportChannel::GetStats(ConnectionInfos *infos) { | 995 bool P2PTransportChannel::GetStats(ConnectionInfos *infos) { |
| 995 ASSERT(worker_thread_ == rtc::Thread::Current()); | 996 ASSERT(worker_thread_ == rtc::Thread::Current()); |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1169 // send; then it will only signal ready-to-send if the media channel | 1170 // send; then it will only signal ready-to-send if the media channel |
| 1170 // has been disallowed to send. | 1171 // has been disallowed to send. |
| 1171 if (best_connection_->writable()) { | 1172 if (best_connection_->writable()) { |
| 1172 SignalReadyToSend(this); | 1173 SignalReadyToSend(this); |
| 1173 } | 1174 } |
| 1174 } else { | 1175 } else { |
| 1175 LOG_J(LS_INFO, this) << "No best connection"; | 1176 LOG_J(LS_INFO, this) << "No best connection"; |
| 1176 } | 1177 } |
| 1177 // TODO(honghaiz): rename best_connection_ with selected_connection_ or | 1178 // TODO(honghaiz): rename best_connection_ with selected_connection_ or |
| 1178 // selected_candidate pair_. | 1179 // selected_candidate pair_. |
| 1179 SignalSelectedCandidatePairChanged(this, best_connection_); | 1180 SignalSelectedCandidatePairChanged(this, best_connection_, |
| 1181 last_sent_packet_id_); |
| 1180 } | 1182 } |
| 1181 | 1183 |
| 1182 // Warning: UpdateState should eventually be called whenever a connection | 1184 // Warning: UpdateState should eventually be called whenever a connection |
| 1183 // is added, deleted, or the write state of any connection changes so that the | 1185 // is added, deleted, or the write state of any connection changes so that the |
| 1184 // transport controller will get the up-to-date channel state. However it | 1186 // transport controller will get the up-to-date channel state. However it |
| 1185 // should not be called too often; in the case that multiple connection states | 1187 // should not be called too often; in the case that multiple connection states |
| 1186 // change, it should be called after all the connection states have changed. For | 1188 // change, it should be called after all the connection states have changed. For |
| 1187 // example, we call this at the end of SortConnections. | 1189 // example, we call this at the end of SortConnections. |
| 1188 void P2PTransportChannel::UpdateState() { | 1190 void P2PTransportChannel::UpdateState() { |
| 1189 state_ = ComputeState(); | 1191 state_ = ComputeState(); |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1631 | 1633 |
| 1632 // During the initial state when nothing has been pinged yet, return the first | 1634 // During the initial state when nothing has been pinged yet, return the first |
| 1633 // one in the ordered |connections_|. | 1635 // one in the ordered |connections_|. |
| 1634 return *(std::find_if(connections_.begin(), connections_.end(), | 1636 return *(std::find_if(connections_.begin(), connections_.end(), |
| 1635 [conn1, conn2](Connection* conn) { | 1637 [conn1, conn2](Connection* conn) { |
| 1636 return conn == conn1 || conn == conn2; | 1638 return conn == conn1 || conn == conn2; |
| 1637 })); | 1639 })); |
| 1638 } | 1640 } |
| 1639 | 1641 |
| 1640 } // namespace cricket | 1642 } // namespace cricket |
| OLD | NEW |