OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 uint32_t start_time_; | 109 uint32_t start_time_; |
110 }; | 110 }; |
111 | 111 |
112 UDPPort::AddressResolver::AddressResolver( | 112 UDPPort::AddressResolver::AddressResolver( |
113 rtc::PacketSocketFactory* factory) | 113 rtc::PacketSocketFactory* factory) |
114 : socket_factory_(factory) {} | 114 : socket_factory_(factory) {} |
115 | 115 |
116 UDPPort::AddressResolver::~AddressResolver() { | 116 UDPPort::AddressResolver::~AddressResolver() { |
117 for (ResolverMap::iterator it = resolvers_.begin(); | 117 for (ResolverMap::iterator it = resolvers_.begin(); |
118 it != resolvers_.end(); ++it) { | 118 it != resolvers_.end(); ++it) { |
119 it->second->Destroy(true); | 119 // TODO(guoweis): Change to asynchronous DNS resolution to prevent the hang |
| 120 // when passing true to the Destroy() which is a safer way to avoid the code |
| 121 // unloaded before the thread exits. Please see webrtc bug 5139. |
| 122 it->second->Destroy(false); |
120 } | 123 } |
121 } | 124 } |
122 | 125 |
123 void UDPPort::AddressResolver::Resolve( | 126 void UDPPort::AddressResolver::Resolve( |
124 const rtc::SocketAddress& address) { | 127 const rtc::SocketAddress& address) { |
125 if (resolvers_.find(address) != resolvers_.end()) | 128 if (resolvers_.find(address) != resolvers_.end()) |
126 return; | 129 return; |
127 | 130 |
128 rtc::AsyncResolverInterface* resolver = | 131 rtc::AsyncResolverInterface* resolver = |
129 socket_factory_->CreateAsyncResolver(); | 132 socket_factory_->CreateAsyncResolver(); |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 const std::vector<Candidate>& existing_candidates = Candidates(); | 479 const std::vector<Candidate>& existing_candidates = Candidates(); |
477 std::vector<Candidate>::const_iterator it = existing_candidates.begin(); | 480 std::vector<Candidate>::const_iterator it = existing_candidates.begin(); |
478 for (; it != existing_candidates.end(); ++it) { | 481 for (; it != existing_candidates.end(); ++it) { |
479 if (it->address() == addr) | 482 if (it->address() == addr) |
480 return true; | 483 return true; |
481 } | 484 } |
482 return false; | 485 return false; |
483 } | 486 } |
484 | 487 |
485 } // namespace cricket | 488 } // namespace cricket |
OLD | NEW |