Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2016 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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 } | 221 } |
| 222 | 222 |
| 223 bool QuicDataChannel::SetTransportChannel( | 223 bool QuicDataChannel::SetTransportChannel( |
| 224 cricket::QuicTransportChannel* channel) { | 224 cricket::QuicTransportChannel* channel) { |
| 225 RTC_DCHECK(signaling_thread_->IsCurrent()); | 225 RTC_DCHECK(signaling_thread_->IsCurrent()); |
| 226 | 226 |
| 227 if (!channel) { | 227 if (!channel) { |
| 228 LOG(LS_ERROR) << "|channel| is NULL. Cannot set transport channel."; | 228 LOG(LS_ERROR) << "|channel| is NULL. Cannot set transport channel."; |
| 229 return false; | 229 return false; |
| 230 } | 230 } |
| 231 if (quic_transport_channel_) { | 231 |
| 232 if (channel == quic_transport_channel_) { | 232 if (channel == quic_transport_channel_) { |
| 233 LOG(LS_WARNING) << "Ignoring duplicate transport channel."; | 233 LOG(LS_WARNING) << "Ignoring duplicate transport channel."; |
| 234 return true; | 234 return true; |
| 235 } | |
| 236 LOG(LS_ERROR) << "|channel| does not match existing transport channel."; | |
| 237 return false; | |
| 238 } | 235 } |
| 239 | 236 |
| 237 // Disconnect from the old transport channel. | |
| 238 if (quic_transport_channel_) { | |
| 239 quic_transport_channel_->SignalReadyToSend.disconnect(this); | |
| 240 quic_transport_channel_->SignalClosed.disconnect(this); | |
| 241 } | |
| 242 // Set new transport channel. | |
|
Taylor Brandstetter
2016/07/21 23:39:57
Is it possible to switch transports in the middle
pthatcher1
2016/07/22 17:57:57
We should at least do this:
if (state_ == kOpen)
Taylor Brandstetter
2016/07/22 19:04:56
If we base the success of "Set___Description" on t
Zhi Huang
2016/07/25 23:40:36
I will revert this change for now. I think we migh
| |
| 240 quic_transport_channel_ = channel; | 243 quic_transport_channel_ = channel; |
| 241 LOG(LS_INFO) << "Setting QuicTransportChannel for QUIC data channel " << id_; | 244 LOG(LS_INFO) << "Setting QuicTransportChannel for QUIC data channel " << id_; |
| 242 DataState data_channel_state = worker_thread_->Invoke<DataState>( | 245 DataState data_channel_state = worker_thread_->Invoke<DataState>( |
| 243 RTC_FROM_HERE, rtc::Bind(&QuicDataChannel::SetTransportChannel_w, this)); | 246 RTC_FROM_HERE, rtc::Bind(&QuicDataChannel::SetTransportChannel_w, this)); |
| 244 SetState_s(data_channel_state); | 247 SetState_s(data_channel_state); |
| 245 return true; | 248 return true; |
| 246 } | 249 } |
| 247 | 250 |
| 248 DataChannelInterface::DataState QuicDataChannel::SetTransportChannel_w() { | 251 DataChannelInterface::DataState QuicDataChannel::SetTransportChannel_w() { |
| 249 RTC_DCHECK(worker_thread_->IsCurrent()); | 252 RTC_DCHECK(worker_thread_->IsCurrent()); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 387 | 390 |
| 388 size_t QuicDataChannel::GetNumWriteBlockedStreams() const { | 391 size_t QuicDataChannel::GetNumWriteBlockedStreams() const { |
| 389 return write_blocked_quic_streams_.size(); | 392 return write_blocked_quic_streams_.size(); |
| 390 } | 393 } |
| 391 | 394 |
| 392 size_t QuicDataChannel::GetNumIncomingStreams() const { | 395 size_t QuicDataChannel::GetNumIncomingStreams() const { |
| 393 return incoming_quic_messages_.size(); | 396 return incoming_quic_messages_.size(); |
| 394 } | 397 } |
| 395 | 398 |
| 396 } // namespace webrtc | 399 } // namespace webrtc |
| OLD | NEW |