Make StunRequest not use auto cleanup.
The class already clears the thread that's used in its dtor
and consistently uses the same thread.
Bug: webrtc:11908
Change-Id: I5ea8d00c2e59bf46c5b369be5b23cf1d8e1875c4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/184060
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32097}
diff --git a/p2p/base/connection.h b/p2p/base/connection.h
index 7c468bc..88e930c 100644
--- a/p2p/base/connection.h
+++ b/p2p/base/connection.h
@@ -65,7 +65,7 @@
int resend_delay() override;
private:
- Connection* connection_;
+ Connection* const connection_;
};
// Represents a communication link between a port on the local client and a
diff --git a/p2p/base/stun_request.cc b/p2p/base/stun_request.cc
index 44376ce..d6210fc 100644
--- a/p2p/base/stun_request.cc
+++ b/p2p/base/stun_request.cc
@@ -174,7 +174,8 @@
}
StunRequest::StunRequest()
- : count_(0),
+ : rtc::MessageHandler(false),
+ count_(0),
timeout_(false),
manager_(0),
msg_(new StunMessage()),
@@ -183,7 +184,12 @@
}
StunRequest::StunRequest(StunMessage* request)
- : count_(0), timeout_(false), manager_(0), msg_(request), tstamp_(0) {
+ : rtc::MessageHandler(false),
+ count_(0),
+ timeout_(false),
+ manager_(0),
+ msg_(request),
+ tstamp_(0) {
msg_->SetTransactionID(rtc::CreateRandomString(kStunTransactionIdLength));
}
diff --git a/p2p/base/stun_request.h b/p2p/base/stun_request.h
index 1756904..39f928e 100644
--- a/p2p/base/stun_request.h
+++ b/p2p/base/stun_request.h
@@ -76,7 +76,7 @@
private:
typedef std::map<std::string, StunRequest*> RequestMap;
- rtc::Thread* thread_;
+ rtc::Thread* const thread_;
RequestMap requests_;
std::string origin_;
@@ -85,7 +85,7 @@
// Represents an individual request to be sent. The STUN message can either be
// constructed beforehand or built on demand.
-class StunRequest : public rtc::MessageHandlerAutoCleanup {
+class StunRequest : public rtc::MessageHandler {
public:
StunRequest();
explicit StunRequest(StunMessage* request);