Minor improvements.
GitOrigin-RevId: 09fbcc25ade8d77c13dc580f13b206c07ba53f9f
This commit is contained in:
parent
3b18309e80
commit
9592aac404
@ -596,6 +596,7 @@ void Session::on_container_sent(uint64 container_id, vector<uint64> msg_ids) {
|
|||||||
void Session::on_message_ack(uint64 id) {
|
void Session::on_message_ack(uint64 id) {
|
||||||
on_message_ack_impl(id, 1);
|
on_message_ack_impl(id, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::on_message_ack_impl(uint64 id, int32 type) {
|
void Session::on_message_ack_impl(uint64 id, int32 type) {
|
||||||
auto cit = sent_containers_.find(id);
|
auto cit = sent_containers_.find(id);
|
||||||
if (cit != sent_containers_.end()) {
|
if (cit != sent_containers_.end()) {
|
||||||
@ -643,6 +644,7 @@ void Session::dec_container(uint64 message_id, Query *query) {
|
|||||||
sent_containers_.erase(it);
|
sent_containers_.erase(it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::cleanup_container(uint64 message_id, Query *query) {
|
void Session::cleanup_container(uint64 message_id, Query *query) {
|
||||||
if (query->container_id == message_id) {
|
if (query->container_id == message_id) {
|
||||||
// message was sent without any container
|
// message was sent without any container
|
||||||
@ -879,6 +881,7 @@ void Session::on_message_info(uint64 id, int32 state, uint64 answer_id, int32 an
|
|||||||
current_info_->connection->resend_answer(answer_id);
|
current_info_->connection->resend_answer(answer_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Status Session::on_destroy_auth_key() {
|
Status Session::on_destroy_auth_key() {
|
||||||
auth_data_.drop_main_auth_key();
|
auth_data_.drop_main_auth_key();
|
||||||
on_auth_key_updated();
|
on_auth_key_updated();
|
||||||
@ -1106,6 +1109,7 @@ void Session::connection_close(ConnectionInfo *info) {
|
|||||||
info->connection->force_close(static_cast<mtproto::SessionConnection::Callback *>(this));
|
info->connection->force_close(static_cast<mtproto::SessionConnection::Callback *>(this));
|
||||||
CHECK(info->state == ConnectionInfo::State::Empty);
|
CHECK(info->state == ConnectionInfo::State::Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Session::need_send_check_main_key() const {
|
bool Session::need_send_check_main_key() const {
|
||||||
return need_check_main_key_ && auth_data_.get_main_auth_key().id() != being_checked_main_auth_key_id_;
|
return need_check_main_key_ && auth_data_.get_main_auth_key().id() != being_checked_main_auth_key_id_;
|
||||||
}
|
}
|
||||||
@ -1135,6 +1139,7 @@ bool Session::need_send_bind_key() const {
|
|||||||
return auth_data_.use_pfs() && !auth_data_.get_bind_flag() &&
|
return auth_data_.use_pfs() && !auth_data_.get_bind_flag() &&
|
||||||
auth_data_.get_tmp_auth_key().id() != being_binded_tmp_auth_key_id_;
|
auth_data_.get_tmp_auth_key().id() != being_binded_tmp_auth_key_id_;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Session::need_send_query() const {
|
bool Session::need_send_query() const {
|
||||||
return !close_flag_ && !need_check_main_key_ && (!auth_data_.use_pfs() || auth_data_.get_bind_flag()) &&
|
return !close_flag_ && !need_check_main_key_ && (!auth_data_.use_pfs() || auth_data_.get_bind_flag()) &&
|
||||||
!pending_queries_.empty() && !can_destroy_auth_key();
|
!pending_queries_.empty() && !can_destroy_auth_key();
|
||||||
|
@ -74,7 +74,7 @@ bool HttpChunkedByteFlow::loop() {
|
|||||||
state_ = State::ReadChunkLength;
|
state_ = State::ReadChunkLength;
|
||||||
len_ = 0;
|
len_ = 0;
|
||||||
}
|
}
|
||||||
} while (0);
|
} while (false);
|
||||||
if (!is_input_active_ && !result) {
|
if (!is_input_active_ && !result) {
|
||||||
finish(Status::Error("Unexpected end of stream"));
|
finish(Status::Error("Unexpected end of stream"));
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,9 @@
|
|||||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
//
|
//
|
||||||
#include "data.h"
|
#include "data.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
|
|
||||||
static const char thumbnail_arr[] =
|
static const char thumbnail_arr[] =
|
||||||
"_9j_4AAQSkZJRgABAQEASABIAAD_2wBDAAICAgICAQICAgIDAgIDAwYEAwMDAwcFBQQGCAcJCAgHCAgJCg0LCQoMCggICw8LDA0ODg8OCQsQERAOEQ"
|
"_9j_4AAQSkZJRgABAQEASABIAAD_2wBDAAICAgICAQICAgIDAgIDAwYEAwMDAwcFBQQGCAcJCAgHCAgJCg0LCQoMCggICw8LDA0ODg8OCQsQERAOEQ"
|
||||||
"0ODg7_2wBDAQIDAwMDAwcEBAcOCQgJDg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg7_wAARCAAyADIDASIA"
|
"0ODg7_2wBDAQIDAwMDAwcEBAcOCQgJDg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg7_wAARCAAyADIDASIA"
|
||||||
@ -152,6 +154,8 @@ static const char sqlite_sample_db_arr[] =
|
|||||||
"Wk6mXCxM++OZxA8K3MGlQuG7Gmodcz6FHh9mqoIZZh6OrObpBUrJfdoZeWXR+"
|
"Wk6mXCxM++OZxA8K3MGlQuG7Gmodcz6FHh9mqoIZZh6OrObpBUrJfdoZeWXR+"
|
||||||
"GVt8zi3m0oPlAhNUyi3a6zeZcvqfwI3M7zoXxGU2q0ETZgfCE26H9E+PNxes7mw4SwEl78lclmnNhUlZ5C4Y8v2YJnmFn8+a6WdrgjTU2awQ/"
|
"GVt8zi3m0oPlAhNUyi3a6zeZcvqfwI3M7zoXxGU2q0ETZgfCE26H9E+PNxes7mw4SwEl78lclmnNhUlZ5C4Y8v2YJnmFn8+a6WdrgjTU2awQ/"
|
||||||
"osSJFtKuNgOw9n72uyhPOkEB4qcVZ1A=";
|
"osSJFtKuNgOw9n72uyhPOkEB4qcVZ1A=";
|
||||||
|
|
||||||
const char *sqlite_sample_db = sqlite_sample_db_arr;
|
const char *sqlite_sample_db = sqlite_sample_db_arr;
|
||||||
const size_t sqlite_sample_db_size = sizeof(sqlite_sample_db_arr) - 1;
|
const size_t sqlite_sample_db_size = sizeof(sqlite_sample_db_arr) - 1;
|
||||||
|
|
||||||
} // namespace td
|
} // namespace td
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
//
|
//
|
||||||
|
#include "data.h"
|
||||||
|
|
||||||
#include "td/db/binlog/BinlogHelper.h"
|
#include "td/db/binlog/BinlogHelper.h"
|
||||||
#include "td/db/binlog/ConcurrentBinlog.h"
|
#include "td/db/binlog/ConcurrentBinlog.h"
|
||||||
#include "td/db/BinlogKeyValue.h"
|
#include "td/db/BinlogKeyValue.h"
|
||||||
@ -28,8 +30,6 @@
|
|||||||
#include "td/utils/Status.h"
|
#include "td/utils/Status.h"
|
||||||
#include "td/utils/tests.h"
|
#include "td/utils/tests.h"
|
||||||
|
|
||||||
#include "data.h"
|
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@ -200,7 +200,7 @@ TEST(DB, sqlite_encryption_migrate) {
|
|||||||
SqliteDb::destroy(path).ignore();
|
SqliteDb::destroy(path).ignore();
|
||||||
auto cucumber = DbKey::password("cucumber");
|
auto cucumber = DbKey::password("cucumber");
|
||||||
auto empty = DbKey::empty();
|
auto empty = DbKey::empty();
|
||||||
if (0) {
|
if (false) {
|
||||||
// sqlite_sample_db was generated by the following code
|
// sqlite_sample_db was generated by the following code
|
||||||
{
|
{
|
||||||
SqliteDb::change_key(path, cucumber, empty).ensure();
|
SqliteDb::change_key(path, cucumber, empty).ensure();
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
//
|
//
|
||||||
#include "td/utils/tests.h"
|
#include "data.h"
|
||||||
|
|
||||||
#include "td/net/HttpChunkedByteFlow.h"
|
#include "td/net/HttpChunkedByteFlow.h"
|
||||||
#include "td/net/HttpHeaderCreator.h"
|
#include "td/net/HttpHeaderCreator.h"
|
||||||
@ -31,10 +31,9 @@
|
|||||||
#include "td/utils/Random.h"
|
#include "td/utils/Random.h"
|
||||||
#include "td/utils/Slice.h"
|
#include "td/utils/Slice.h"
|
||||||
#include "td/utils/Status.h"
|
#include "td/utils/Status.h"
|
||||||
|
#include "td/utils/tests.h"
|
||||||
#include "td/utils/UInt.h"
|
#include "td/utils/UInt.h"
|
||||||
|
|
||||||
#include "data.h"
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
|
@ -4,13 +4,12 @@
|
|||||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
//
|
//
|
||||||
#include "td/utils/tests.h"
|
|
||||||
|
|
||||||
#include "td/utils/common.h"
|
#include "td/utils/common.h"
|
||||||
#include "td/utils/crypto.h"
|
#include "td/utils/crypto.h"
|
||||||
#include "td/utils/logging.h"
|
#include "td/utils/logging.h"
|
||||||
#include "td/utils/OptionParser.h"
|
#include "td/utils/OptionParser.h"
|
||||||
#include "td/utils/Slice.h"
|
#include "td/utils/Slice.h"
|
||||||
|
#include "td/utils/tests.h"
|
||||||
|
|
||||||
#if TD_EMSCRIPTEN
|
#if TD_EMSCRIPTEN
|
||||||
#include <emscripten.h>
|
#include <emscripten.h>
|
||||||
|
@ -4,10 +4,11 @@
|
|||||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
//
|
//
|
||||||
#include "td/utils/tests.h"
|
#include "td/telegram/ConfigManager.h"
|
||||||
|
#include "td/telegram/net/DcId.h"
|
||||||
#include "td/actor/actor.h"
|
#include "td/telegram/net/PublicRsaKeyShared.h"
|
||||||
#include "td/actor/PromiseFuture.h"
|
#include "td/telegram/net/Session.h"
|
||||||
|
#include "td/telegram/NotificationManager.h"
|
||||||
|
|
||||||
#include "td/mtproto/AuthData.h"
|
#include "td/mtproto/AuthData.h"
|
||||||
#include "td/mtproto/DhHandshake.h"
|
#include "td/mtproto/DhHandshake.h"
|
||||||
@ -25,11 +26,8 @@
|
|||||||
#include "td/net/Socks5.h"
|
#include "td/net/Socks5.h"
|
||||||
#include "td/net/TransparentProxy.h"
|
#include "td/net/TransparentProxy.h"
|
||||||
|
|
||||||
#include "td/telegram/ConfigManager.h"
|
#include "td/actor/actor.h"
|
||||||
#include "td/telegram/net/DcId.h"
|
#include "td/actor/PromiseFuture.h"
|
||||||
#include "td/telegram/net/PublicRsaKeyShared.h"
|
|
||||||
#include "td/telegram/net/Session.h"
|
|
||||||
#include "td/telegram/NotificationManager.h"
|
|
||||||
|
|
||||||
#include "td/utils/base64.h"
|
#include "td/utils/base64.h"
|
||||||
#include "td/utils/common.h"
|
#include "td/utils/common.h"
|
||||||
@ -39,6 +37,7 @@
|
|||||||
#include "td/utils/port/SocketFd.h"
|
#include "td/utils/port/SocketFd.h"
|
||||||
#include "td/utils/Random.h"
|
#include "td/utils/Random.h"
|
||||||
#include "td/utils/Status.h"
|
#include "td/utils/Status.h"
|
||||||
|
#include "td/utils/tests.h"
|
||||||
#include "td/utils/Time.h"
|
#include "td/utils/Time.h"
|
||||||
|
|
||||||
REGISTER_TESTS(mtproto);
|
REGISTER_TESTS(mtproto);
|
||||||
|
@ -4,14 +4,14 @@
|
|||||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
//
|
//
|
||||||
|
#include "td/telegram/SecureStorage.h"
|
||||||
|
|
||||||
#include "td/utils/buffer.h"
|
#include "td/utils/buffer.h"
|
||||||
#include "td/utils/filesystem.h"
|
#include "td/utils/filesystem.h"
|
||||||
#include "td/utils/logging.h"
|
#include "td/utils/logging.h"
|
||||||
#include "td/utils/port/path.h"
|
#include "td/utils/port/path.h"
|
||||||
#include "td/utils/tests.h"
|
#include "td/utils/tests.h"
|
||||||
|
|
||||||
#include "td/telegram/SecureStorage.h"
|
|
||||||
|
|
||||||
using namespace td;
|
using namespace td;
|
||||||
|
|
||||||
TEST(SecureStorage, secret) {
|
TEST(SecureStorage, secret) {
|
||||||
|
@ -6,15 +6,14 @@
|
|||||||
//
|
//
|
||||||
#include "data.h"
|
#include "data.h"
|
||||||
|
|
||||||
#include "td/actor/actor.h"
|
|
||||||
#include "td/actor/PromiseFuture.h"
|
|
||||||
|
|
||||||
#include "td/telegram/Client.h"
|
#include "td/telegram/Client.h"
|
||||||
#include "td/telegram/ClientActor.h"
|
#include "td/telegram/ClientActor.h"
|
||||||
#include "td/telegram/files/PartsManager.h"
|
#include "td/telegram/files/PartsManager.h"
|
||||||
|
|
||||||
#include "td/telegram/td_api.h"
|
#include "td/telegram/td_api.h"
|
||||||
|
|
||||||
|
#include "td/actor/actor.h"
|
||||||
|
#include "td/actor/PromiseFuture.h"
|
||||||
|
|
||||||
#include "td/utils/base64.h"
|
#include "td/utils/base64.h"
|
||||||
#include "td/utils/BufferedFd.h"
|
#include "td/utils/BufferedFd.h"
|
||||||
#include "td/utils/common.h"
|
#include "td/utils/common.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user