Add dns_resolver log tag.
GitOrigin-RevId: 17fed9f8350bb49e18b875ed21290c7805875df6
This commit is contained in:
parent
aab7300681
commit
0b7def8733
@ -14,9 +14,10 @@
|
|||||||
#include "td/telegram/Td.h"
|
#include "td/telegram/Td.h"
|
||||||
#include "td/telegram/UpdatesManager.h"
|
#include "td/telegram/UpdatesManager.h"
|
||||||
|
|
||||||
#include "tddb/td/db/binlog/BinlogEvent.h"
|
#include "td/db/binlog/BinlogEvent.h"
|
||||||
|
|
||||||
#include "tdnet/td/net/TransparentProxy.h"
|
#include "td/net/GetHostByNameActor.h"
|
||||||
|
#include "td/net/TransparentProxy.h"
|
||||||
|
|
||||||
#include "td/utils/FileLog.h"
|
#include "td/utils/FileLog.h"
|
||||||
#include "td/utils/logging.h"
|
#include "td/utils/logging.h"
|
||||||
@ -39,7 +40,7 @@ static const std::map<Slice, int *> log_tags{
|
|||||||
ADD_TAG(proxy), ADD_TAG(net_query), ADD_TAG(td_requests), ADD_TAG(dc),
|
ADD_TAG(proxy), ADD_TAG(net_query), ADD_TAG(td_requests), ADD_TAG(dc),
|
||||||
ADD_TAG(files), ADD_TAG(mtproto), ADD_TAG(raw_mtproto), ADD_TAG(fd),
|
ADD_TAG(files), ADD_TAG(mtproto), ADD_TAG(raw_mtproto), ADD_TAG(fd),
|
||||||
ADD_TAG(actor), ADD_TAG(buffer), ADD_TAG(sqlite), ADD_TAG(notifications),
|
ADD_TAG(actor), ADD_TAG(buffer), ADD_TAG(sqlite), ADD_TAG(notifications),
|
||||||
ADD_TAG(get_difference), ADD_TAG(file_gc), ADD_TAG(config_recoverer)};
|
ADD_TAG(get_difference), ADD_TAG(file_gc), ADD_TAG(config_recoverer), ADD_TAG(dns_resolver)};
|
||||||
#undef ADD_TAG
|
#undef ADD_TAG
|
||||||
|
|
||||||
Status Logging::set_current_stream(td_api::object_ptr<td_api::LogStream> stream) {
|
Status Logging::set_current_stream(td_api::object_ptr<td_api::LogStream> stream) {
|
||||||
|
@ -79,8 +79,9 @@ class GoogleDnsResolver : public Actor {
|
|||||||
void on_result(Result<HttpQueryPtr> r_http_query) {
|
void on_result(Result<HttpQueryPtr> r_http_query) {
|
||||||
auto end_time = Time::now();
|
auto end_time = Time::now();
|
||||||
auto result = get_ip_address(std::move(r_http_query));
|
auto result = get_ip_address(std::move(r_http_query));
|
||||||
LOG(WARNING) << "Init IPv" << (prefer_ipv6_ ? "6" : "4") << " host = " << host_ << " in " << end_time - begin_time_
|
VLOG(dns_resolver) << "Init IPv" << (prefer_ipv6_ ? "6" : "4") << " host = " << host_ << " in "
|
||||||
<< " seconds to " << (result.is_ok() ? (PSLICE() << result.ok()) : CSlice("[invalid]"));
|
<< end_time - begin_time_ << " seconds to "
|
||||||
|
<< (result.is_ok() ? (PSLICE() << result.ok()) : CSlice("[invalid]"));
|
||||||
promise_.set_result(std::move(result));
|
promise_.set_result(std::move(result));
|
||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
@ -102,7 +103,7 @@ class NativeDnsResolver : public Actor {
|
|||||||
auto begin_time = Time::now();
|
auto begin_time = Time::now();
|
||||||
auto status = ip.init_host_port(host_, 0, prefer_ipv6_);
|
auto status = ip.init_host_port(host_, 0, prefer_ipv6_);
|
||||||
auto end_time = Time::now();
|
auto end_time = Time::now();
|
||||||
LOG(WARNING) << "Init host = " << host_ << " in " << end_time - begin_time << " seconds to " << ip;
|
VLOG(dns_resolver) << "Init host = " << host_ << " in " << end_time - begin_time << " seconds to " << ip;
|
||||||
if (status.is_error()) {
|
if (status.is_error()) {
|
||||||
promise_.set_error(std::move(status));
|
promise_.set_error(std::move(status));
|
||||||
} else {
|
} else {
|
||||||
@ -114,6 +115,8 @@ class NativeDnsResolver : public Actor {
|
|||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
|
int VERBOSITY_NAME(dns_resolver) = VERBOSITY_NAME(DEBUG);
|
||||||
|
|
||||||
GetHostByNameActor::GetHostByNameActor(Options options) : options_(std::move(options)) {
|
GetHostByNameActor::GetHostByNameActor(Options options) : options_(std::move(options)) {
|
||||||
CHECK(!options_.resolver_types.empty());
|
CHECK(!options_.resolver_types.empty());
|
||||||
}
|
}
|
||||||
@ -181,8 +184,8 @@ void GetHostByNameActor::on_query_result(std::string host, bool prefer_ipv6, Res
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto end_time = Time::now();
|
auto end_time = Time::now();
|
||||||
LOG(WARNING) << "Init host = " << query.real_host << " in total of " << end_time - query.begin_time << " seconds to "
|
VLOG(dns_resolver) << "Init host = " << query.real_host << " in total of " << end_time - query.begin_time
|
||||||
<< (result.is_ok() ? (PSLICE() << result.ok()) : CSlice("[invalid]"));
|
<< " seconds to " << (result.is_ok() ? (PSLICE() << result.ok()) : CSlice("[invalid]"));
|
||||||
|
|
||||||
auto promises = std::move(query.promises);
|
auto promises = std::move(query.promises);
|
||||||
auto value_it = cache_[prefer_ipv6].find(host);
|
auto value_it = cache_[prefer_ipv6].find(host);
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include "td/actor/actor.h"
|
#include "td/actor/actor.h"
|
||||||
#include "td/actor/PromiseFuture.h"
|
#include "td/actor/PromiseFuture.h"
|
||||||
|
|
||||||
|
#include "td/utils/logging.h"
|
||||||
#include "td/utils/port/IPAddress.h"
|
#include "td/utils/port/IPAddress.h"
|
||||||
#include "td/utils/Status.h"
|
#include "td/utils/Status.h"
|
||||||
|
|
||||||
@ -16,6 +17,8 @@
|
|||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
|
|
||||||
|
extern int VERBOSITY_NAME(dns_resolver);
|
||||||
|
|
||||||
class GetHostByNameActor final : public Actor {
|
class GetHostByNameActor final : public Actor {
|
||||||
public:
|
public:
|
||||||
enum class ResolverType { Native, Google };
|
enum class ResolverType { Native, Google };
|
||||||
|
Reference in New Issue
Block a user