OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2008 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2008 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 *addr = addr_; | 101 *addr = addr_; |
102 for (size_t i = 0; i < addresses_.size(); ++i) { | 102 for (size_t i = 0; i < addresses_.size(); ++i) { |
103 if (family == addresses_[i].family()) { | 103 if (family == addresses_[i].family()) { |
104 addr->SetResolvedIP(addresses_[i]); | 104 addr->SetResolvedIP(addresses_[i]); |
105 return true; | 105 return true; |
106 } | 106 } |
107 } | 107 } |
108 return false; | 108 return false; |
109 } | 109 } |
110 | 110 |
| 111 int64_t AsyncResolver::GetResolveElapsedTimeMilliseconds() const { |
| 112 return resolve_time_ms_; |
| 113 } |
| 114 |
111 int AsyncResolver::GetError() const { | 115 int AsyncResolver::GetError() const { |
112 return error_; | 116 return error_; |
113 } | 117 } |
114 | 118 |
115 void AsyncResolver::Destroy(bool wait) { | 119 void AsyncResolver::Destroy(bool wait) { |
116 SignalThread::Destroy(wait); | 120 SignalThread::Destroy(wait); |
117 } | 121 } |
118 | 122 |
119 void AsyncResolver::DoWork() { | 123 void AsyncResolver::DoWork() { |
| 124 int64_t start = rtc::TimeMillis(); |
120 error_ = ResolveHostname(addr_.hostname().c_str(), addr_.family(), | 125 error_ = ResolveHostname(addr_.hostname().c_str(), addr_.family(), |
121 &addresses_); | 126 &addresses_); |
| 127 int64_t stop = rtc::TimeMillis(); |
| 128 resolve_time_ms_ = stop - start; |
122 } | 129 } |
123 | 130 |
124 void AsyncResolver::OnWorkDone() { | 131 void AsyncResolver::OnWorkDone() { |
125 SignalDone(this); | 132 SignalDone(this); |
126 } | 133 } |
127 | 134 |
128 const char* inet_ntop(int af, const void *src, char* dst, socklen_t size) { | 135 const char* inet_ntop(int af, const void *src, char* dst, socklen_t size) { |
129 #if defined(WEBRTC_WIN) | 136 #if defined(WEBRTC_WIN) |
130 return win32_inet_ntop(af, src, dst, size); | 137 return win32_inet_ntop(af, src, dst, size); |
131 #else | 138 #else |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 break; | 217 break; |
211 } | 218 } |
212 } | 219 } |
213 freeifaddrs(ifa); | 220 freeifaddrs(ifa); |
214 return has_ipv6; | 221 return has_ipv6; |
215 #else | 222 #else |
216 return true; | 223 return true; |
217 #endif | 224 #endif |
218 } | 225 } |
219 } // namespace rtc | 226 } // namespace rtc |
OLD | NEW |