Index: webrtc/p2p/base/transport.h |
diff --git a/webrtc/p2p/base/transport.h b/webrtc/p2p/base/transport.h |
index d7ebc9cbe4adbcdb2af886bb8dbb648dd2af8695..2230b9fe8a9bd607412b229f9dc236d572a5b0e2 100644 |
--- a/webrtc/p2p/base/transport.h |
+++ b/webrtc/p2p/base/transport.h |
@@ -53,7 +53,7 @@ class TransportChannelImpl; |
typedef std::vector<Candidate> Candidates; |
-// For "writable" and "readable", we need to differentiate between |
+// For "writable", "readable", and "receiving", we need to differentiate between |
// none, all, and some. |
enum TransportState { |
TRANSPORT_STATE_NONE = 0, |
@@ -61,6 +61,14 @@ enum TransportState { |
TRANSPORT_STATE_ALL |
}; |
+// When checking transport state, we need to differentiate between |
+// "readable", "writable", or "receiving" check. |
+enum TransportStateType { |
+ TRANSPORT_READABLE_STATE = 0, |
+ TRANSPORT_WRITABLE_STATE, |
+ TRANSPORT_RECEIVING_STATE |
+}; |
+ |
// Stats that we can return about the connections for a transport channel. |
// TODO(hta): Rename to ConnectionStats |
struct ConnectionInfo { |
@@ -172,8 +180,14 @@ class Transport : public rtc::MessageHandler, |
bool all_channels_writable() const { |
return (writable_ == TRANSPORT_STATE_ALL); |
} |
+ bool any_channel_receiving() const { |
+ return (receiving_ == TRANSPORT_STATE_SOME || |
+ receiving_ == TRANSPORT_STATE_ALL); |
+ } |
+ |
sigslot::signal1<Transport*> SignalReadableState; |
sigslot::signal1<Transport*> SignalWritableState; |
+ sigslot::signal1<Transport*> SignalReceivingState; |
sigslot::signal1<Transport*> SignalCompleted; |
sigslot::signal1<Transport*> SignalFailed; |
@@ -363,6 +377,9 @@ class Transport : public rtc::MessageHandler, |
void OnChannelReadableState(TransportChannel* channel); |
void OnChannelWritableState(TransportChannel* channel); |
+ // Called when the receiving state of a channel changes. |
+ void OnChannelReceivingState(TransportChannel* channel); |
+ |
// Called when a channel requests signaling. |
void OnChannelRequestSignaling(TransportChannelImpl* channel); |
@@ -393,6 +410,7 @@ class Transport : public rtc::MessageHandler, |
void OnRemoteCandidate_w(const Candidate& candidate); |
void OnChannelReadableState_s(); |
void OnChannelWritableState_s(); |
+ void OnChannelReceivingState_s(); |
void OnChannelRequestSignaling_s(); |
void OnConnecting_s(); |
void OnChannelRouteChange_s(const TransportChannel* channel, |
@@ -403,8 +421,9 @@ class Transport : public rtc::MessageHandler, |
typedef void (TransportChannelImpl::* TransportChannelFunc)(); |
void CallChannels_w(TransportChannelFunc func); |
- // Computes the OR of the channel's read or write state (argument picks). |
- TransportState GetTransportState_s(bool read); |
+ // Computes the AND and OR of the channel's read/write/receiving state |
+ // (argument picks the operation). |
+ TransportState GetTransportState_s(TransportStateType type); |
void OnChannelCandidateReady_s(); |
@@ -430,6 +449,7 @@ class Transport : public rtc::MessageHandler, |
bool destroyed_; |
TransportState readable_; |
TransportState writable_; |
+ TransportState receiving_; |
bool was_writable_; |
bool connect_requested_; |
IceRole ice_role_; |