Dump network queries from oldest to newest.

This commit is contained in:
levlam 2021-06-20 03:05:58 +03:00
parent 1202d55e27
commit ca7c1e5ada
2 changed files with 3 additions and 3 deletions

View File

@ -145,7 +145,6 @@ static char *command_generator(const char *text, int state) {
"CancelDownloadFile",
"ImportContacts",
"RemoveContacts",
"DumpNetQueries",
"CreateSecretChat",
"CreateNewSecretChat"};
static size_t cmd_i;
@ -4304,7 +4303,7 @@ class CliClient final : public Actor {
}
} else if (op == "q" || op == "Quit") {
quit();
} else if (op == "dnq" || op == "DumpNetQueries") {
} else if (op == "dnq") {
dump_pending_network_queries(*net_query_stats_);
} else if (op == "fatal") {
LOG(FATAL) << "Fatal!";

View File

@ -31,7 +31,8 @@ void NetQueryStats::dump_pending_network_queries() {
bool was_gap = false;
auto &net_query_list = list_;
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++) {
for (auto begin = net_query_list.begin(), cur = net_query_list.end(); cur != begin; i++) {
cur = cur->get_prev();
if (i < 20 || i + 20 > n || i % (n / 20 + 1) == 0) {
if (was_gap) {
LOG(WARNING) << "...";