The gathering of host candidates with mDNS names is asynchronous and its completion can happen after a srflx candidate is gathered by the same underlying socket. We have a broken check in UDPPort::CreateConnection() that assumes the gathering of host and srflx candidates is sequential. This CL also does minor refactoring and clean-up. Bug: chromium:944577 Change-Id: Ic28136a9515081f40b232a22fcbf4209814ed33a Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/138043 Reviewed-by: Steve Anton <steveanton@webrtc.org> Reviewed-by: Jeroen de Borst <jeroendb@webrtc.org> Reviewed-by: Amit Hilbuch <amithi@webrtc.org> Commit-Queue: Qingsi Wang <qingsi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#28030}