DCHECK that PortAllocator::SetConfiguration does not create a pooled

session on a non-network thread.

Bug: webrtc:9112
Change-Id: I79c31f1a7cd299dad8f9034cc9b83fcd8d3328f7
Reviewed-on: https://webrtc-review.googlesource.com/c/103305
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Qingsi Wang <qingsi@webrtc.org>
Reviewed-by: Jeroen de Borst <jeroendb@webrtc.org>
Commit-Queue: Qingsi Wang <qingsi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24940}
This commit is contained in:
Qingsi Wang
2018-10-02 16:00:41 -07:00
committed by Commit Bot
parent 60de683b6f
commit e6ded16045

View File

@ -129,6 +129,10 @@ bool PortAllocator::SetConfiguration(
webrtc::TurnCustomizer* turn_customizer,
const absl::optional<int>& stun_candidate_keepalive_interval) {
CheckRunOnValidThreadIfInitialized();
// A positive candidate pool size would lead to the creation of a pooled
// allocator session and starting getting ports, which we should only do on
// the network thread.
RTC_DCHECK(candidate_pool_size == 0 || thread_checker_.CalledOnValidThread());
bool ice_servers_changed =
(stun_servers != stun_servers_ || turn_servers != turn_servers_);
stun_servers_ = stun_servers;