Remove global net_query_list_.
GitOrigin-RevId: 345564fa64a1a6abe6e936713ab05c5c16e4a723
This commit is contained in:
parent
2d22f4d13e
commit
fcb7a51eb0
@ -15,8 +15,6 @@
|
|||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
|
|
||||||
TsList<NetQueryDebug> net_query_list_;
|
|
||||||
|
|
||||||
int32 NetQuery::get_my_id() {
|
int32 NetQuery::get_my_id() {
|
||||||
return G()->get_my_id();
|
return G()->get_my_id();
|
||||||
}
|
}
|
||||||
@ -64,14 +62,20 @@ void NetQuery::set_error(Status status, string source) {
|
|||||||
set_error_impl(std::move(status), std::move(source));
|
set_error_impl(std::move(status), std::move(source));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TsList<NetQueryDebug> &NetQuery::get_net_query_list() {
|
||||||
|
static TsList<NetQueryDebug> net_query_list;
|
||||||
|
return net_query_list;
|
||||||
|
}
|
||||||
|
|
||||||
void dump_pending_network_queries() {
|
void dump_pending_network_queries() {
|
||||||
auto n = NetQueryCounter::get_count();
|
auto n = NetQueryCounter::get_count();
|
||||||
LOG(WARNING) << tag("pending net queries", n);
|
LOG(WARNING) << tag("pending net queries", n);
|
||||||
|
|
||||||
decltype(n) i = 0;
|
decltype(n) i = 0;
|
||||||
bool was_gap = false;
|
bool was_gap = false;
|
||||||
auto guard = net_query_list_.lock();
|
auto &net_query_list = NetQuery::get_net_query_list();
|
||||||
for (auto end = net_query_list_.end(), cur = net_query_list_.begin(); cur != end; cur = cur->get_next(), i++) {
|
auto guard = net_query_list.lock();
|
||||||
|
for (auto end = net_query_list.end(), cur = net_query_list.begin(); cur != end; cur = cur->get_next(), i++) {
|
||||||
if (i < 20 || i + 20 > n || i % (n / 20 + 1) == 0) {
|
if (i < 20 || i + 20 > n || i % (n / 20 + 1) == 0) {
|
||||||
if (was_gap) {
|
if (was_gap) {
|
||||||
LOG(WARNING) << "...";
|
LOG(WARNING) << "...";
|
||||||
|
@ -52,8 +52,6 @@ struct NetQueryDebug {
|
|||||||
bool debug_unknown_ = false;
|
bool debug_unknown_ = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern TsList<NetQueryDebug> net_query_list_;
|
|
||||||
|
|
||||||
class NetQuery : public TsListNode<NetQueryDebug> {
|
class NetQuery : public TsListNode<NetQueryDebug> {
|
||||||
public:
|
public:
|
||||||
NetQuery() = default;
|
NetQuery() = default;
|
||||||
@ -281,6 +279,8 @@ class NetQuery : public TsListNode<NetQueryDebug> {
|
|||||||
|
|
||||||
static int32 tl_magic(const BufferSlice &buffer_slice);
|
static int32 tl_magic(const BufferSlice &buffer_slice);
|
||||||
|
|
||||||
|
static TsList<NetQueryDebug> &get_net_query_list();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
State state_ = State::Empty;
|
State state_ = State::Empty;
|
||||||
Type type_ = Type::Common;
|
Type type_ = Type::Common;
|
||||||
@ -360,7 +360,7 @@ class NetQuery : public TsListNode<NetQueryDebug> {
|
|||||||
get_data_unsafe().my_id_ = get_my_id();
|
get_data_unsafe().my_id_ = get_my_id();
|
||||||
get_data_unsafe().start_timestamp_ = Time::now();
|
get_data_unsafe().start_timestamp_ = Time::now();
|
||||||
LOG(INFO) << *this;
|
LOG(INFO) << *this;
|
||||||
net_query_list_.put(this);
|
get_net_query_list().put(this);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user