Let receiving() and SignalRecevingState be part of rtc::PacketTransportInterface.

Writable() and the related signal are already part of rtc::PacketTransportInterface. Sense of code symmetry aesthetics dictates that receiving() and the related signal should be declared in the same place.

BUG=webrtc:6531

Review-Url: https://codereview.webrtc.org/2444793003
Cr-Commit-Position: refs/heads/master@{#14865}
This commit is contained in:
johan 2016-11-01 01:47:41 -07:00 committed by Commit bot
parent fe647f4ab2
commit 15ca8f6aeb
6 changed files with 15 additions and 7 deletions

View File

@ -471,9 +471,10 @@ void DtlsTransportChannelWrapper::OnWritableState(
}
}
void DtlsTransportChannelWrapper::OnReceivingState(TransportChannel* channel) {
void DtlsTransportChannelWrapper::OnReceivingState(
rtc::PacketTransportInterface* transport) {
ASSERT(rtc::Thread::Current() == network_thread_);
RTC_DCHECK(channel == channel_);
RTC_DCHECK(transport == channel_);
LOG_J(LS_VERBOSE, this)
<< "DTLSTransportChannelWrapper: channel receiving state changed to "
<< channel_->receiving();

View File

@ -216,7 +216,7 @@ class DtlsTransportChannelWrapper : public TransportChannelImpl {
void OnSentPacket(rtc::PacketTransportInterface* transport,
const rtc::SentPacket& sent_packet);
void OnReadyToSend(rtc::PacketTransportInterface* transport);
void OnReceivingState(TransportChannel* channel);
void OnReceivingState(rtc::PacketTransportInterface* transport);
void OnDtlsEvent(rtc::StreamInterface* stream_, int sig, int err);
bool SetupDtls();
void MaybeStartDtls();

View File

@ -36,6 +36,10 @@ class PacketTransportInterface : public sigslot::has_slots<> {
// The transport has been established.
virtual bool writable() const = 0;
// The transport has received a packet in the last X milliseconds, here X is
// configured by each implementation.
virtual bool receiving() const = 0;
// Attempts to send the given packet.
// The return value is < 0 on failure. The return value in failure case is not
// descriptive. Depending on failure cause and implementation details
@ -70,6 +74,9 @@ class PacketTransportInterface : public sigslot::has_slots<> {
// SendPacket's return code and/or GetError.
sigslot::signal1<PacketTransportInterface*> SignalReadyToSend;
// Emitted when receiving state changes to true.
sigslot::signal1<PacketTransportInterface*> SignalReceivingState;
// Signalled each time a packet is received on this channel.
sigslot::signal5<PacketTransportInterface*,
const char*,

View File

@ -76,9 +76,8 @@ class TransportChannel : public rtc::PacketTransportInterface {
// Returns the states of this channel. Each time one of these states changes,
// a signal is raised. These states are aggregated by the TransportManager.
bool writable() const override { return writable_; }
bool receiving() const { return receiving_; }
bool receiving() const override { return receiving_; }
DtlsTransportState dtls_state() const { return dtls_state_; }
sigslot::signal1<TransportChannel*> SignalReceivingState;
// Emitted whenever DTLS-SRTP is setup which will require setting up a new
// SRTP context.
sigslot::signal2<TransportChannel*, DtlsTransportState> SignalDtlsState;

View File

@ -573,7 +573,8 @@ void TransportController::OnChannelWritableState_n(
UpdateAggregateStates_n();
}
void TransportController::OnChannelReceivingState_n(TransportChannel* channel) {
void TransportController::OnChannelReceivingState_n(
rtc::PacketTransportInterface* transport) {
RTC_DCHECK(network_thread_->IsCurrent());
UpdateAggregateStates_n();
}

View File

@ -206,7 +206,7 @@ class TransportController : public sigslot::has_slots<>,
// Handlers for signals from Transport.
void OnChannelWritableState_n(rtc::PacketTransportInterface* transport);
void OnChannelReceivingState_n(TransportChannel* channel);
void OnChannelReceivingState_n(rtc::PacketTransportInterface* transport);
void OnChannelGatheringState_n(TransportChannelImpl* channel);
void OnChannelCandidateGathered_n(TransportChannelImpl* channel,
const Candidate& candidate);