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}
This commit is contained in:
Tomas Gunnarsson
2020-09-12 15:41:52 +02:00
committed by Commit Bot
parent 6da271844c
commit 4d76a13b33
3 changed files with 11 additions and 5 deletions

View File

@ -65,7 +65,7 @@ class ConnectionRequest : public StunRequest {
int resend_delay() override;
private:
Connection* connection_;
Connection* const connection_;
};
// Represents a communication link between a port on the local client and a

View File

@ -174,7 +174,8 @@ bool StunRequestManager::CheckResponse(const char* data, size_t size) {
}
StunRequest::StunRequest()
: count_(0),
: rtc::MessageHandler(false),
count_(0),
timeout_(false),
manager_(0),
msg_(new StunMessage()),
@ -183,7 +184,12 @@ StunRequest::StunRequest()
}
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));
}

View File

@ -76,7 +76,7 @@ class StunRequestManager {
private:
typedef std::map<std::string, StunRequest*> RequestMap;
rtc::Thread* thread_;
rtc::Thread* const thread_;
RequestMap requests_;
std::string origin_;
@ -85,7 +85,7 @@ class StunRequestManager {
// 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);