mirror of
https://github.com/tdlight-team/tdlight-telegram-bot-api.git
synced 2024-09-01 12:05:41 +02:00
Unlink webhook certificate in another thread.
This commit is contained in:
parent
0749acb7e6
commit
ca2bb3cec6
@ -8550,14 +8550,25 @@ void Client::webhook_error(Status status) {
|
||||
}
|
||||
|
||||
void Client::webhook_closed(Status status) {
|
||||
if (has_webhook_certificate_) {
|
||||
td::Scheduler::instance()->run_on_scheduler(get_database_scheduler_id(),
|
||||
[actor_id = actor_id(this), path = get_webhook_certificate_path(),
|
||||
status = std::move(status)](td::Unit) mutable {
|
||||
LOG(INFO) << "Unlink certificate " << path;
|
||||
td::unlink(path).ignore();
|
||||
send_closure(actor_id, &Client::on_webhook_closed, std::move(status));
|
||||
});
|
||||
return;
|
||||
}
|
||||
on_webhook_closed(std::move(status));
|
||||
}
|
||||
|
||||
void Client::on_webhook_closed(Status status) {
|
||||
LOG(WARNING) << "Webhook closed: " << status
|
||||
<< ", webhook_query_type = " << (webhook_query_type_ == WebhookQueryType::Verify ? "verify" : "change");
|
||||
webhook_id_.release();
|
||||
webhook_url_ = td::string();
|
||||
if (has_webhook_certificate_) {
|
||||
td::unlink(get_webhook_certificate_path()).ignore();
|
||||
has_webhook_certificate_ = false;
|
||||
}
|
||||
has_webhook_certificate_ = false;
|
||||
webhook_max_connections_ = 0;
|
||||
webhook_ip_address_ = td::string();
|
||||
webhook_fix_ip_address_ = false;
|
||||
|
@ -563,6 +563,8 @@ class Client final : public WebhookActor::Callback {
|
||||
void save_webhook() const;
|
||||
td::string get_webhook_certificate_path() const;
|
||||
|
||||
void on_webhook_closed(Status status);
|
||||
|
||||
void do_send_message(object_ptr<td_api::InputMessageContent> input_message_content, PromisedQueryPtr query);
|
||||
|
||||
int64 get_send_message_query_id(PromisedQueryPtr query, bool is_multisend);
|
||||
|
Loading…
Reference in New Issue
Block a user