Minor improvements.

main
levlam 8 months ago
parent 6d97899c0d
commit efb4951436

@ -699,8 +699,8 @@ class Client::JsonStickers final : public td::Jsonable {
class Client::JsonLocation final : public td::Jsonable { class Client::JsonLocation final : public td::Jsonable {
public: public:
explicit JsonLocation(const td_api::location *location, double expires_in = 0.0, int32 live_period = 0, JsonLocation(const td_api::location *location, double expires_in = 0.0, int32 live_period = 0, int32 heading = 0,
int32 heading = 0, int32 proximity_alert_radius = 0) int32 proximity_alert_radius = 0)
: location_(location) : location_(location)
, expires_in_(expires_in) , expires_in_(expires_in)
, live_period_(live_period) , live_period_(live_period)
@ -1358,8 +1358,7 @@ class Client::JsonGift final : public td::Jsonable {
class Client::JsonGifts final : public td::Jsonable { class Client::JsonGifts final : public td::Jsonable {
public: public:
JsonGifts(const td::vector<td_api::object_ptr<td_api::gift>> &gifts, const Client *client) JsonGifts(const td::vector<object_ptr<td_api::gift>> &gifts, const Client *client) : gifts_(gifts), client_(client) {
: gifts_(gifts), client_(client) {
} }
void store(td::JsonValueScope *scope) const { void store(td::JsonValueScope *scope) const {
auto object = scope->enter_object(); auto object = scope->enter_object();
@ -1367,7 +1366,7 @@ class Client::JsonGifts final : public td::Jsonable {
} }
private: private:
const td::vector<td_api::object_ptr<td_api::gift>> &gifts_; const td::vector<object_ptr<td_api::gift>> &gifts_;
const Client *client_; const Client *client_;
}; };
@ -16279,7 +16278,7 @@ bool Client::need_skip_update_message(int64 chat_id, const object_ptr<td_api::me
} }
if (!supergroup_info->is_supergroup && message->content_->get_id() == td_api::messageSupergroupChatCreate::ID) { if (!supergroup_info->is_supergroup && message->content_->get_id() == td_api::messageSupergroupChatCreate::ID) {
// don't send message about channel creation, even the bot was added at exactly the same time // don't send message about channel creation, even if the bot was added at exactly the same time
return true; return true;
} }
} }
@ -17160,7 +17159,7 @@ td::int32 Client::get_unix_time() const {
} }
td::int64 Client::get_implicit_reply_to_message_id(int64 chat_id, int64 message_id, td::int64 Client::get_implicit_reply_to_message_id(int64 chat_id, int64 message_id,
const td_api::object_ptr<td_api::MessageTopic> &topic_id) const { const object_ptr<td_api::MessageTopic> &topic_id) const {
if (topic_id == nullptr) { if (topic_id == nullptr) {
return 0; return 0;
} }
@ -17190,7 +17189,7 @@ td::int64 Client::get_implicit_reply_to_message_id(int64 chat_id, int64 message_
return implicit_reply_to_message_id < message_id ? implicit_reply_to_message_id : 0; return implicit_reply_to_message_id < message_id ? implicit_reply_to_message_id : 0;
} }
td::int32 Client::get_forum_topic_id(const td_api::object_ptr<td_api::MessageTopic> &topic_id) { td::int32 Client::get_forum_topic_id(const object_ptr<td_api::MessageTopic> &topic_id) {
if (topic_id == nullptr) { if (topic_id == nullptr) {
return 0; return 0;
} }

@ -522,10 +522,10 @@ class Client final : public WebhookActor::Callback {
object_ptr<td_api::inputThumbnail> get_input_thumbnail(const Query *query) const; object_ptr<td_api::inputThumbnail> get_input_thumbnail(const Query *query) const;
static td::Result<td_api::object_ptr<td_api::inlineQueryResultsButton>> get_inline_query_results_button( static td::Result<object_ptr<td_api::inlineQueryResultsButton>> get_inline_query_results_button(
td::JsonValue &&value); td::JsonValue &&value);
static td::Result<td_api::object_ptr<td_api::inlineQueryResultsButton>> get_inline_query_results_button( static td::Result<object_ptr<td_api::inlineQueryResultsButton>> get_inline_query_results_button(
td::MutableSlice value); td::MutableSlice value);
static td::Result<object_ptr<td_api::InputInlineQueryResult>> get_inline_query_result(const Query *query, static td::Result<object_ptr<td_api::InputInlineQueryResult>> get_inline_query_result(const Query *query,
@ -1232,9 +1232,9 @@ class Client final : public WebhookActor::Callback {
int32 get_unix_time() const; int32 get_unix_time() const;
int64 get_implicit_reply_to_message_id(int64 chat_id, int64 message_id, int64 get_implicit_reply_to_message_id(int64 chat_id, int64 message_id,
const td_api::object_ptr<td_api::MessageTopic> &topic_id) const; const object_ptr<td_api::MessageTopic> &topic_id) const;
static int32 get_forum_topic_id(const td_api::object_ptr<td_api::MessageTopic> &topic_id); static int32 get_forum_topic_id(const object_ptr<td_api::MessageTopic> &topic_id);
static int64 as_tdlib_message_id(int32 message_id); static int64 as_tdlib_message_id(int32 message_id);

@ -58,7 +58,7 @@ class ServerCpuStat {
private: private:
static constexpr std::size_t SIZE = 4; static constexpr std::size_t SIZE = 4;
static constexpr const char *DESCR[SIZE] = {"inf", "5sec", "1min", "1hour"}; static constexpr const char *DESCR[SIZE] = {"inf", "5sec", "1min", "1hour"};
static constexpr int DURATIONS[SIZE] = {0, 5, 60, 60 * 60}; static constexpr td::int32 DURATIONS[SIZE] = {0, 5, 60, 60 * 60};
std::mutex mutex_; std::mutex mutex_;
td::TimedStat<CpuStat> stat_[SIZE]; td::TimedStat<CpuStat> stat_[SIZE];
@ -191,7 +191,7 @@ class BotStatActor final : public td::Actor {
private: private:
static constexpr std::size_t SIZE = 4; static constexpr std::size_t SIZE = 4;
static constexpr const char *DESCR[SIZE] = {"inf", "5sec", "1min", "1hour"}; static constexpr const char *DESCR[SIZE] = {"inf", "5sec", "1min", "1hour"};
static constexpr int DURATIONS[SIZE] = {0, 5, 60, 60 * 60}; static constexpr td::int32 DURATIONS[SIZE] = {0, 5, 60, 60 * 60};
td::TimedStat<ServerBotStat> stat_[SIZE]; td::TimedStat<ServerBotStat> stat_[SIZE];
td::ActorId<BotStatActor> parent_; td::ActorId<BotStatActor> parent_;

@ -148,7 +148,7 @@ td::Status WebhookActor::create_connection() {
return create_webhook_error("Can't connect to the webhook proxy", r_proxy_socket_fd.move_as_error(), false); return create_webhook_error("Can't connect to the webhook proxy", r_proxy_socket_fd.move_as_error(), false);
} }
if (!was_checked_) { if (!was_checked_) {
// verify webhook even we can't establish connection to the webhook // verify webhook even if we can't establish connection to the webhook
was_checked_ = true; was_checked_ = true;
on_webhook_verified(); on_webhook_verified();
} }

@ -71,9 +71,9 @@ class WebhookActor final : public td::HttpOutboundConnection::Callback {
private: private:
static constexpr std::size_t MIN_PENDING_UPDATES_WARNING = 50; static constexpr std::size_t MIN_PENDING_UPDATES_WARNING = 50;
static constexpr int IP_ADDRESS_CACHE_TIME = 30 * 60; // 30 minutes static constexpr td::int32 IP_ADDRESS_CACHE_TIME = 30 * 60; // 30 minutes
static constexpr int WEBHOOK_MAX_RESEND_TIMEOUT = 60; static constexpr td::int32 WEBHOOK_MAX_RESEND_TIMEOUT = 60;
static constexpr int WEBHOOK_DROP_TIMEOUT = 60 * 60 * 23; static constexpr td::int32 WEBHOOK_DROP_TIMEOUT = 60 * 60 * 23;
static std::atomic<td::uint64> total_connection_count_; static std::atomic<td::uint64> total_connection_count_;

Loading…
Cancel
Save