Connect SignalDestroyed in AllocationSequence after TURN ports are destroyed
when TURN ports are using shared socket with UDP port. This is required as AllocationSequence maintains a map of turn ports. If the ports are destroyed without the knowledge of AllocationSequence, sequence will try to deliver packets to the destoyed ports. R=jiayl@webrtc.org BUG=https://code.google.com/p/chromium/issues/detail?id=368877 Review URL: https://webrtc-codereview.appspot.com/14569007 git-svn-id: http://webrtc.googlecode.com/svn/trunk@6219 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
88fbb2d86b
commit
8e755c1ad2
@ -102,6 +102,7 @@ class AllocationSequence : public talk_base::MessageHandler,
|
||||
uint32 flags);
|
||||
~AllocationSequence();
|
||||
bool Init();
|
||||
void Clear();
|
||||
|
||||
State state() const { return state_; }
|
||||
|
||||
@ -258,6 +259,12 @@ BasicPortAllocatorSession::~BasicPortAllocatorSession() {
|
||||
if (network_thread_ != NULL)
|
||||
network_thread_->Clear(this);
|
||||
|
||||
for (uint32 i = 0; i < sequences_.size(); ++i) {
|
||||
// AllocationSequence should clear it's map entry for turn ports before
|
||||
// ports are destroyed.
|
||||
sequences_[i]->Clear();
|
||||
}
|
||||
|
||||
std::vector<PortData>::iterator it;
|
||||
for (it = ports_.begin(); it != ports_.end(); it++)
|
||||
delete it->port();
|
||||
@ -727,6 +734,11 @@ bool AllocationSequence::Init() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void AllocationSequence::Clear() {
|
||||
udp_port_ = NULL;
|
||||
turn_ports_.clear();
|
||||
}
|
||||
|
||||
AllocationSequence::~AllocationSequence() {
|
||||
session_->network_thread()->Clear(this);
|
||||
}
|
||||
@ -1030,6 +1042,9 @@ void AllocationSequence::CreateTurnPort(const RelayServerConfig& config) {
|
||||
this, &AllocationSequence::OnResolvedTurnServerAddress);
|
||||
}
|
||||
turn_ports_[(*relay_port).address] = port;
|
||||
// Listen to the port destroyed signal, to allow AllocationSequence to
|
||||
// remove entrt from it's map.
|
||||
port->SignalDestroyed.connect(this, &AllocationSequence::OnPortDestroyed);
|
||||
} else {
|
||||
port = TurnPort::Create(session_->network_thread(),
|
||||
session_->socket_factory(),
|
||||
|
Loading…
Reference in New Issue
Block a user