| 92 | |
| 93 | private: |
| 94 | inline TResolvedHostPtr ResolveA(const TResolveTask& rt) { |
| 95 | TString originalHost(rt.Info.Host); |
| 96 | TString host(originalHost); |
| 97 | |
| 98 | //3. replace host to alias, if exist |
| 99 | if (A_.size()) { |
| 100 | TReadGuard guard(LA_); |
| 101 | TString names[] = {"*", host}; |
| 102 | |
| 103 | for (const auto& name : names) { |
| 104 | TAliases::const_iterator it = A_.find(name); |
| 105 | |
| 106 | if (it != A_.end()) { |
| 107 | host = it->second; |
| 108 | } |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | if (host.length() > 2 && host[0] == '[') { |
| 113 | TString unbracedIpV6(host.data() + 1, host.size() - 2); |
| 114 | host.swap(unbracedIpV6); |
| 115 | } |
| 116 | |
| 117 | TAutoPtr<TNetworkAddress> na; |
| 118 | |
| 119 | //4. getaddrinfo (direct or in separate thread) |
| 120 | if (rt.Method == TResolveTask::Normal) { |
| 121 | na.Reset(new TNetworkAddress(host, rt.Info.Port)); |
| 122 | } else if (rt.Method == TResolveTask::Threaded) { |
| 123 | na = ThreadedResolve(host, rt.Info.Port); |
| 124 | } else { |
| 125 | Y_ASSERT(0); |
| 126 | throw yexception() << TStringBuf("invalid resolve method"); |
| 127 | } |
| 128 | |
| 129 | return new TResolvedHost(originalHost, *na); |
| 130 | } |
| 131 | |
| 132 | typedef THashMap<TResolveInfo, TResolvedHostPtr, THashResolveInfo, TCompareResolveInfo> TCache; |
| 133 | TCache C_; |
nothing calls this directly
no test coverage detected