Merge pull request #57 from tdlight-team/merge-upstream

Merge upstream - update tdlight to 1.7.3
This commit is contained in:
Andrea Cavalli 2021-04-06 14:39:04 +02:00 committed by GitHub
commit 9c8fd6e667
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 9 deletions

2
td

@ -1 +1 @@
Subproject commit ebeaf7f90e733441f417a52dee7920f6b76c8f71
Subproject commit 70e15f4707d19a96bb79242c8f6be1b16ac5875f

View File

@ -69,7 +69,7 @@ void Client::fail_query_with_error(PromisedQueryPtr query, int32 error_code, Sli
return query->set_retry_after_error(r_retry_after.ok());
}
}
LOG(ERROR) << "Wrong error message: " << error_message;
LOG(ERROR) << "Wrong error message: " << error_message << " from " << *query;
return fail_query(500, error_message, std::move(query));
}
int32 real_error_code = error_code;
@ -125,8 +125,6 @@ void Client::fail_query_with_error(PromisedQueryPtr query, int32 error_code, Sli
} else if (error_message == "MESSAGE_DELETE_FORBIDDEN") {
error_code = 400;
error_message = Slice("message can't be deleted");
} else if (error_message == "Requested data is inaccessible") {
LOG(ERROR) << "Receive 'Requested data is inaccessible' from " << *query;
}
}
Slice prefix;
@ -146,11 +144,11 @@ void Client::fail_query_with_error(PromisedQueryPtr query, int32 error_code, Sli
case 500:
prefix = Slice("Internal Server Error");
if (real_error_message != Slice("Request aborted")) {
LOG(ERROR) << "Receive Internal Server Error: " << real_error_message;
LOG(ERROR) << "Receive Internal Server Error \"" << real_error_message << "\" from " << *query;
}
break;
default:
LOG(ERROR) << "Unsupported error " << real_error_code << ": " << real_error_message;
LOG(ERROR) << "Unsupported error " << real_error_code << ": " << real_error_message << " from " << *query;
return fail_query(400, PSLICE() << "Bad Request: " << error_message, std::move(query));
}
@ -159,7 +157,7 @@ void Client::fail_query_with_error(PromisedQueryPtr query, int32 error_code, Sli
} else {
td::string error_str = prefix.str();
if (error_message.empty()) {
LOG(ERROR) << "Empty error message with code " << real_error_code;
LOG(ERROR) << "Empty error message with code " << real_error_code << " from " << *query;
} else {
error_str += ": ";
if (error_message.size() >= 2u &&
@ -4531,7 +4529,7 @@ void Client::on_update_authorization_state() {
parameters->api_hash_ = parameters_->api_hash_;
parameters->system_language_code_ = "en";
parameters->device_model_ = "server";
parameters->application_version_ = "5.1";
parameters->application_version_ = parameters_->version_;
parameters->enable_storage_optimizer_ = true;
parameters->ignore_file_names_ = true;
@ -9162,6 +9160,9 @@ void Client::add_group(std::unordered_map<int32, GroupInfo> &groups, object_ptr<
group_info->kicked = group->status_->get_id() == td_api::chatMemberStatusBanned::ID;
group_info->is_active = group->is_active_;
group_info->upgraded_to_supergroup_id = group->upgraded_to_supergroup_id_;
if (!group_info->left && !group_info->kicked && group_info->member_count == 0) {
group_info->member_count = 1;
}
}
const Client::GroupInfo *Client::get_group_info(int32 group_id) const {

View File

@ -66,6 +66,8 @@ struct ClientParameters {
td::int32 api_id_ = 0;
td::string api_hash_;
td::string version_;
td::int32 default_max_webhook_connections_ = 0;
td::IPAddress webhook_proxy_ip_address_;

View File

@ -134,6 +134,7 @@ int main(int argc, char *argv[]) {
auto start_time = td::Time::now();
auto shared_data = std::make_shared<SharedData>();
auto parameters = std::make_unique<ClientParameters>();
parameters->version_ = "5.1";
parameters->shared_data_ = shared_data;
parameters->start_time_ = start_time;
auto net_query_stats = td::create_net_query_stats();
@ -412,7 +413,7 @@ int main(int argc, char *argv[]) {
// LOG(WARNING) << "Bot API server with commit " << td::GitInfo::commit() << ' '
// << (td::GitInfo::is_dirty() ? "(dirty)" : "") << " started";
LOG(WARNING) << "Bot API server started";
LOG(WARNING) << "Bot API " << parameters->version_ << " server started";
const int threads_n = 5; // +3 for Td, one for slow HTTP connections and one for DNS resolving
td::ConcurrentScheduler sched;