Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(431)

Side by Side Diff: webrtc/rtc_base/nethelpers.cc

Issue 3012473002: Revert of Add logging of host lookups made by TurnPort to the RtcEventLog. (Closed)
Patch Set: Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/rtc_base/nethelpers.h ('k') | webrtc/rtc_tools/event_log_visualizer/analyzer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 } 77 }
78 } 78 }
79 } 79 }
80 freeaddrinfo(result); 80 freeaddrinfo(result);
81 return 0; 81 return 0;
82 #endif // !__native_client__ 82 #endif // !__native_client__
83 } 83 }
84 84
85 // AsyncResolver 85 // AsyncResolver
86 AsyncResolver::AsyncResolver() 86 AsyncResolver::AsyncResolver()
87 : SignalThread(false /* use_socket_server */), 87 : SignalThread(false /* use_socket_server */), error_(-1) {}
88 error_(-1), resolve_time_ms_(0) {}
89 88
90 AsyncResolver::~AsyncResolver() = default; 89 AsyncResolver::~AsyncResolver() = default;
91 90
92 void AsyncResolver::Start(const SocketAddress& addr) { 91 void AsyncResolver::Start(const SocketAddress& addr) {
93 addr_ = addr; 92 addr_ = addr;
94 // SignalThred Start will kickoff the resolve process. 93 // SignalThred Start will kickoff the resolve process.
95 SignalThread::Start(); 94 SignalThread::Start();
96 } 95 }
97 96
98 bool AsyncResolver::GetResolvedAddress(int family, SocketAddress* addr) const { 97 bool AsyncResolver::GetResolvedAddress(int family, SocketAddress* addr) const {
99 if (error_ != 0 || addresses_.empty()) 98 if (error_ != 0 || addresses_.empty())
100 return false; 99 return false;
101 100
102 *addr = addr_; 101 *addr = addr_;
103 for (size_t i = 0; i < addresses_.size(); ++i) { 102 for (size_t i = 0; i < addresses_.size(); ++i) {
104 if (family == addresses_[i].family()) { 103 if (family == addresses_[i].family()) {
105 addr->SetResolvedIP(addresses_[i]); 104 addr->SetResolvedIP(addresses_[i]);
106 return true; 105 return true;
107 } 106 }
108 } 107 }
109 return false; 108 return false;
110 } 109 }
111 110
112 int64_t AsyncResolver::GetResolveElapsedTimeMilliseconds() const {
113 return resolve_time_ms_;
114 }
115
116 int AsyncResolver::GetError() const { 111 int AsyncResolver::GetError() const {
117 return error_; 112 return error_;
118 } 113 }
119 114
120 void AsyncResolver::Destroy(bool wait) { 115 void AsyncResolver::Destroy(bool wait) {
121 SignalThread::Destroy(wait); 116 SignalThread::Destroy(wait);
122 } 117 }
123 118
124 void AsyncResolver::DoWork() { 119 void AsyncResolver::DoWork() {
125 int64_t start = rtc::TimeMillis();
126 error_ = ResolveHostname(addr_.hostname().c_str(), addr_.family(), 120 error_ = ResolveHostname(addr_.hostname().c_str(), addr_.family(),
127 &addresses_); 121 &addresses_);
128 int64_t stop = rtc::TimeMillis();
129 resolve_time_ms_ = stop - start;
130 } 122 }
131 123
132 void AsyncResolver::OnWorkDone() { 124 void AsyncResolver::OnWorkDone() {
133 SignalDone(this); 125 SignalDone(this);
134 } 126 }
135 127
136 const char* inet_ntop(int af, const void *src, char* dst, socklen_t size) { 128 const char* inet_ntop(int af, const void *src, char* dst, socklen_t size) {
137 #if defined(WEBRTC_WIN) 129 #if defined(WEBRTC_WIN)
138 return win32_inet_ntop(af, src, dst, size); 130 return win32_inet_ntop(af, src, dst, size);
139 #else 131 #else
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 break; 210 break;
219 } 211 }
220 } 212 }
221 freeifaddrs(ifa); 213 freeifaddrs(ifa);
222 return has_ipv6; 214 return has_ipv6;
223 #else 215 #else
224 return true; 216 return true;
225 #endif 217 #endif
226 } 218 }
227 } // namespace rtc 219 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/rtc_base/nethelpers.h ('k') | webrtc/rtc_tools/event_log_visualizer/analyzer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698