Remove dependency on MessageHandlerAutoCleanup from cricket::Port.
Bug: webrtc:11988 Change-Id: I15335cf49365de1274f5d3051dcb2de97e9e263b Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/194562 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#32673}
This commit is contained in:
parent
fd53dd8660
commit
91e4156a8c
@ -188,6 +188,9 @@ void Port::Construct() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Port::~Port() {
|
Port::~Port() {
|
||||||
|
RTC_DCHECK_RUN_ON(thread_);
|
||||||
|
CancelPendingTasks();
|
||||||
|
|
||||||
// Delete all of the remaining connections. We copy the list up front
|
// Delete all of the remaining connections. We copy the list up front
|
||||||
// because each deletion will cause it to be modified.
|
// because each deletion will cause it to be modified.
|
||||||
|
|
||||||
@ -609,6 +612,16 @@ rtc::DiffServCodePoint Port::StunDscpValue() const {
|
|||||||
return rtc::DSCP_NO_CHANGE;
|
return rtc::DSCP_NO_CHANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Port::set_timeout_delay(int delay) {
|
||||||
|
RTC_DCHECK_RUN_ON(thread_);
|
||||||
|
// Although this method is meant to only be used by tests, some downstream
|
||||||
|
// projects have started using it. Ideally we should update our tests to not
|
||||||
|
// require to modify this state and instead use a testing harness that allows
|
||||||
|
// adjusting the clock and then just use the kPortTimeoutDelay constant
|
||||||
|
// directly.
|
||||||
|
timeout_delay_ = delay;
|
||||||
|
}
|
||||||
|
|
||||||
bool Port::ParseStunUsername(const StunMessage* stun_msg,
|
bool Port::ParseStunUsername(const StunMessage* stun_msg,
|
||||||
std::string* local_ufrag,
|
std::string* local_ufrag,
|
||||||
std::string* remote_ufrag) const {
|
std::string* remote_ufrag) const {
|
||||||
@ -818,7 +831,14 @@ void Port::Prune() {
|
|||||||
thread_->Post(RTC_FROM_HERE, this, MSG_DESTROY_IF_DEAD);
|
thread_->Post(RTC_FROM_HERE, this, MSG_DESTROY_IF_DEAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Call to stop any currently pending operations from running.
|
||||||
|
void Port::CancelPendingTasks() {
|
||||||
|
RTC_DCHECK_RUN_ON(thread_);
|
||||||
|
thread_->Clear(this);
|
||||||
|
}
|
||||||
|
|
||||||
void Port::OnMessage(rtc::Message* pmsg) {
|
void Port::OnMessage(rtc::Message* pmsg) {
|
||||||
|
RTC_DCHECK_RUN_ON(thread_);
|
||||||
RTC_DCHECK(pmsg->message_id == MSG_DESTROY_IF_DEAD);
|
RTC_DCHECK(pmsg->message_id == MSG_DESTROY_IF_DEAD);
|
||||||
bool dead =
|
bool dead =
|
||||||
(state_ == State::INIT || state_ == State::PRUNED) &&
|
(state_ == State::INIT || state_ == State::PRUNED) &&
|
||||||
|
|||||||
@ -160,7 +160,7 @@ typedef std::set<rtc::SocketAddress> ServerAddresses;
|
|||||||
// connections to similar mechanisms of the other client. Subclasses of this
|
// connections to similar mechanisms of the other client. Subclasses of this
|
||||||
// one add support for specific mechanisms like local UDP ports.
|
// one add support for specific mechanisms like local UDP ports.
|
||||||
class Port : public PortInterface,
|
class Port : public PortInterface,
|
||||||
public rtc::MessageHandlerAutoCleanup,
|
public rtc::MessageHandler,
|
||||||
public sigslot::has_slots<> {
|
public sigslot::has_slots<> {
|
||||||
public:
|
public:
|
||||||
// INIT: The state when a port is just created.
|
// INIT: The state when a port is just created.
|
||||||
@ -209,6 +209,9 @@ class Port : public PortInterface,
|
|||||||
// Allows a port to be destroyed if no connection is using it.
|
// Allows a port to be destroyed if no connection is using it.
|
||||||
void Prune();
|
void Prune();
|
||||||
|
|
||||||
|
// Call to stop any currently pending operations from running.
|
||||||
|
void CancelPendingTasks();
|
||||||
|
|
||||||
// The thread on which this port performs its I/O.
|
// The thread on which this port performs its I/O.
|
||||||
rtc::Thread* thread() { return thread_; }
|
rtc::Thread* thread() { return thread_; }
|
||||||
|
|
||||||
@ -322,7 +325,7 @@ class Port : public PortInterface,
|
|||||||
uint16_t max_port() { return max_port_; }
|
uint16_t max_port() { return max_port_; }
|
||||||
|
|
||||||
// Timeout shortening function to speed up unit tests.
|
// Timeout shortening function to speed up unit tests.
|
||||||
void set_timeout_delay(int delay) { timeout_delay_ = delay; }
|
void set_timeout_delay(int delay);
|
||||||
|
|
||||||
// This method will return local and remote username fragements from the
|
// This method will return local and remote username fragements from the
|
||||||
// stun username attribute if present.
|
// stun username attribute if present.
|
||||||
@ -437,7 +440,7 @@ class Port : public PortInterface,
|
|||||||
|
|
||||||
void OnNetworkTypeChanged(const rtc::Network* network);
|
void OnNetworkTypeChanged(const rtc::Network* network);
|
||||||
|
|
||||||
rtc::Thread* thread_;
|
rtc::Thread* const thread_;
|
||||||
rtc::PacketSocketFactory* factory_;
|
rtc::PacketSocketFactory* factory_;
|
||||||
std::string type_;
|
std::string type_;
|
||||||
bool send_retransmit_count_attribute_;
|
bool send_retransmit_count_attribute_;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user