| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 << "SendThresholdCallback: Failed to get transport for socket " | 378 << "SendThresholdCallback: Failed to get transport for socket " |
| 379 << sock; | 379 << sock; |
| 380 return 0; | 380 return 0; |
| 381 } | 381 } |
| 382 transport->OnSendThresholdCallback(); | 382 transport->OnSendThresholdCallback(); |
| 383 return 0; | 383 return 0; |
| 384 } | 384 } |
| 385 }; | 385 }; |
| 386 | 386 |
| 387 SctpTransport::SctpTransport(rtc::Thread* network_thread, | 387 SctpTransport::SctpTransport(rtc::Thread* network_thread, |
| 388 rtc::PacketTransportInterface* channel) | 388 rtc::PacketTransportInternal* channel) |
| 389 : network_thread_(network_thread), | 389 : network_thread_(network_thread), |
| 390 transport_channel_(channel), | 390 transport_channel_(channel), |
| 391 was_ever_writable_(channel->writable()) { | 391 was_ever_writable_(channel->writable()) { |
| 392 RTC_DCHECK(network_thread_); | 392 RTC_DCHECK(network_thread_); |
| 393 RTC_DCHECK(transport_channel_); | 393 RTC_DCHECK(transport_channel_); |
| 394 RTC_DCHECK_RUN_ON(network_thread_); | 394 RTC_DCHECK_RUN_ON(network_thread_); |
| 395 ConnectTransportChannelSignals(); | 395 ConnectTransportChannelSignals(); |
| 396 } | 396 } |
| 397 | 397 |
| 398 SctpTransport::~SctpTransport() { | 398 SctpTransport::~SctpTransport() { |
| 399 // Close abruptly; no reset procedure. | 399 // Close abruptly; no reset procedure. |
| 400 CloseSctpSocket(); | 400 CloseSctpSocket(); |
| 401 } | 401 } |
| 402 | 402 |
| 403 void SctpTransport::SetTransportChannel( | 403 void SctpTransport::SetTransportChannel(rtc::PacketTransportInternal* channel) { |
| 404 rtc::PacketTransportInterface* channel) { | |
| 405 RTC_DCHECK_RUN_ON(network_thread_); | 404 RTC_DCHECK_RUN_ON(network_thread_); |
| 406 RTC_DCHECK(channel); | 405 RTC_DCHECK(channel); |
| 407 DisconnectTransportChannelSignals(); | 406 DisconnectTransportChannelSignals(); |
| 408 transport_channel_ = channel; | 407 transport_channel_ = channel; |
| 409 ConnectTransportChannelSignals(); | 408 ConnectTransportChannelSignals(); |
| 410 if (!was_ever_writable_ && channel->writable()) { | 409 if (!was_ever_writable_ && channel->writable()) { |
| 411 was_ever_writable_ = true; | 410 was_ever_writable_ = true; |
| 412 // New channel is writable, now we can start the SCTP connection if Start | 411 // New channel is writable, now we can start the SCTP connection if Start |
| 413 // was called already. | 412 // was called already. |
| 414 if (started_) { | 413 if (started_) { |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 801 } | 800 } |
| 802 | 801 |
| 803 void SctpTransport::SetReadyToSendData() { | 802 void SctpTransport::SetReadyToSendData() { |
| 804 RTC_DCHECK_RUN_ON(network_thread_); | 803 RTC_DCHECK_RUN_ON(network_thread_); |
| 805 if (!ready_to_send_data_) { | 804 if (!ready_to_send_data_) { |
| 806 ready_to_send_data_ = true; | 805 ready_to_send_data_ = true; |
| 807 SignalReadyToSendData(); | 806 SignalReadyToSendData(); |
| 808 } | 807 } |
| 809 } | 808 } |
| 810 | 809 |
| 811 void SctpTransport::OnWritableState(rtc::PacketTransportInterface* transport) { | 810 void SctpTransport::OnWritableState(rtc::PacketTransportInternal* transport) { |
| 812 RTC_DCHECK_RUN_ON(network_thread_); | 811 RTC_DCHECK_RUN_ON(network_thread_); |
| 813 RTC_DCHECK_EQ(transport_channel_, transport); | 812 RTC_DCHECK_EQ(transport_channel_, transport); |
| 814 if (!was_ever_writable_ && transport->writable()) { | 813 if (!was_ever_writable_ && transport->writable()) { |
| 815 was_ever_writable_ = true; | 814 was_ever_writable_ = true; |
| 816 if (started_) { | 815 if (started_) { |
| 817 Connect(); | 816 Connect(); |
| 818 } | 817 } |
| 819 } | 818 } |
| 820 } | 819 } |
| 821 | 820 |
| 822 // Called by network interface when a packet has been received. | 821 // Called by network interface when a packet has been received. |
| 823 void SctpTransport::OnPacketRead(rtc::PacketTransportInterface* transport, | 822 void SctpTransport::OnPacketRead(rtc::PacketTransportInternal* transport, |
| 824 const char* data, | 823 const char* data, |
| 825 size_t len, | 824 size_t len, |
| 826 const rtc::PacketTime& packet_time, | 825 const rtc::PacketTime& packet_time, |
| 827 int flags) { | 826 int flags) { |
| 828 RTC_DCHECK_RUN_ON(network_thread_); | 827 RTC_DCHECK_RUN_ON(network_thread_); |
| 829 RTC_DCHECK_EQ(transport_channel_, transport); | 828 RTC_DCHECK_EQ(transport_channel_, transport); |
| 830 TRACE_EVENT0("webrtc", "SctpTransport::OnPacketRead"); | 829 TRACE_EVENT0("webrtc", "SctpTransport::OnPacketRead"); |
| 831 | 830 |
| 832 // TODO(pthatcher): Do this in a more robust way by checking for | 831 // TODO(pthatcher): Do this in a more robust way by checking for |
| 833 // SCTP or DTLS. | 832 // SCTP or DTLS. |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1083 } | 1082 } |
| 1084 } | 1083 } |
| 1085 } | 1084 } |
| 1086 | 1085 |
| 1087 // Always try to send the queued RESET because this call indicates that the | 1086 // Always try to send the queued RESET because this call indicates that the |
| 1088 // last local RESET or remote RESET has made some progress. | 1087 // last local RESET or remote RESET has made some progress. |
| 1089 SendQueuedStreamResets(); | 1088 SendQueuedStreamResets(); |
| 1090 } | 1089 } |
| 1091 | 1090 |
| 1092 } // namespace cricket | 1091 } // namespace cricket |
| OLD | NEW |