diff --git a/td/mtproto/RawConnection.cpp b/td/mtproto/RawConnection.cpp index 7b5bd844..0dfc76cd 100644 --- a/td/mtproto/RawConnection.cpp +++ b/td/mtproto/RawConnection.cpp @@ -11,7 +11,7 @@ #include "td/utils/format.h" #include "td/utils/logging.h" -#include "td/utils/Slice.h" +#include "td/utils/misc.h" #include "td/utils/Status.h" #include diff --git a/td/mtproto/Transport.h b/td/mtproto/Transport.h index 5591cfcd..2e732142 100644 --- a/td/mtproto/Transport.h +++ b/td/mtproto/Transport.h @@ -9,6 +9,7 @@ #include "td/utils/common.h" #include "td/utils/int_types.h" +#include "td/utils/logging.h" #include "td/utils/Slice.h" #include "td/utils/Status.h" diff --git a/td/telegram/AuthManager.cpp b/td/telegram/AuthManager.cpp index 122f5f2a..91498a6a 100644 --- a/td/telegram/AuthManager.cpp +++ b/td/telegram/AuthManager.cpp @@ -15,6 +15,7 @@ #include "td/telegram/ContactsManager.h" #include "td/telegram/Global.h" #include "td/telegram/misc.h" +#include "td/telegram/net/DcId.h" #include "td/telegram/net/NetQueryDispatcher.h" #include "td/telegram/Td.h" #include "td/telegram/UpdatesManager.h" diff --git a/td/telegram/ConfigManager.cpp b/td/telegram/ConfigManager.cpp index 2d88448e..07a57174 100644 --- a/td/telegram/ConfigManager.cpp +++ b/td/telegram/ConfigManager.cpp @@ -10,9 +10,12 @@ #include "td/telegram/Global.h" #include "td/telegram/logevent/LogEvent.h" #include "td/telegram/net/ConnectionCreator.h" +#include "td/telegram/net/DcId.h" #include "td/telegram/net/DcOptions.h" #include "td/telegram/net/NetQuery.h" #include "td/telegram/net/NetQueryDispatcher.h" +#include "td/telegram/net/NetType.h" +#include "td/telegram/net/PublicRsaKeyShared.h" #include "td/telegram/net/Session.h" #if !TD_EMSCRIPTEN //FIXME diff --git a/td/telegram/ConfigManager.h b/td/telegram/ConfigManager.h index a76fc15f..062288d7 100644 --- a/td/telegram/ConfigManager.h +++ b/td/telegram/ConfigManager.h @@ -6,6 +6,7 @@ // #pragma once +#include "td/telegram/net/DcId.h" #include "td/telegram/net/DcOptions.h" #include "td/telegram/net/NetQuery.h" diff --git a/td/telegram/DocumentsManager.cpp b/td/telegram/DocumentsManager.cpp index afa13519..c7a76c9a 100644 --- a/td/telegram/DocumentsManager.cpp +++ b/td/telegram/DocumentsManager.cpp @@ -10,6 +10,7 @@ #include "td/telegram/AudiosManager.h" #include "td/telegram/files/FileManager.h" #include "td/telegram/Global.h" +#include "td/telegram/net/DcId.h" #include "td/telegram/Photo.h" #include "td/telegram/StickersManager.h" #include "td/telegram/Td.h" diff --git a/td/telegram/Global.h b/td/telegram/Global.h index 378b590f..5d11722f 100644 --- a/td/telegram/Global.h +++ b/td/telegram/Global.h @@ -57,6 +57,7 @@ class WebPagesManager; }; // namespace td namespace td { + class Global : public ActorContext { public: Global(); @@ -348,4 +349,5 @@ inline Global *G() { CHECK(Scheduler::context()); return static_cast(Scheduler::context()); } + } // namespace td diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index f0c048df..42d015e0 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -5,14 +5,6 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // #include "td/telegram/MessagesManager.h" -#include "td/telegram/secret_api.hpp" -#include "td/telegram/td_api.hpp" -#include "td/telegram/telegram_api.h" - -#include "td/actor/PromiseFuture.h" -#include "td/actor/SleepActor.h" - -#include "td/db/binlog/BinlogHelper.h" #include "td/telegram/AnimationsManager.h" #include "td/telegram/AnimationsManager.hpp" @@ -35,6 +27,7 @@ #include "td/telegram/MessageEntity.hpp" #include "td/telegram/MessagesDb.h" #include "td/telegram/misc.h" +#include "td/telegram/net/DcId.h" #include "td/telegram/net/NetActor.h" #include "td/telegram/net/NetQuery.h" #include "td/telegram/Payments.h" @@ -59,6 +52,15 @@ #include "td/telegram/WebPageId.h" #include "td/telegram/WebPagesManager.h" +#include "td/telegram/secret_api.hpp" +#include "td/telegram/td_api.hpp" +#include "td/telegram/telegram_api.h" + +#include "td/actor/PromiseFuture.h" +#include "td/actor/SleepActor.h" + +#include "td/db/binlog/BinlogHelper.h" + #include "td/utils/format.h" #include "td/utils/HttpUrl.h" #include "td/utils/MimeType.h" diff --git a/td/telegram/Photo.cpp b/td/telegram/Photo.cpp index 2f72b103..7876e3e5 100644 --- a/td/telegram/Photo.cpp +++ b/td/telegram/Photo.cpp @@ -11,6 +11,7 @@ #include "td/telegram/files/FileManager.h" #include "td/telegram/Global.h" +#include "td/telegram/net/DcId.h" #include "td/utils/common.h" #include "td/utils/format.h" diff --git a/td/telegram/SecureValue.cpp b/td/telegram/SecureValue.cpp index 024dbe96..29c86b56 100644 --- a/td/telegram/SecureValue.cpp +++ b/td/telegram/SecureValue.cpp @@ -10,6 +10,7 @@ #include "td/telegram/files/FileManager.h" #include "td/telegram/Global.h" #include "td/telegram/misc.h" +#include "td/telegram/net/DcId.h" #include "td/telegram/Payments.h" #include "td/telegram/td_api.h" diff --git a/td/telegram/StickersManager.cpp b/td/telegram/StickersManager.cpp index fb078540..2d07d656 100644 --- a/td/telegram/StickersManager.cpp +++ b/td/telegram/StickersManager.cpp @@ -23,6 +23,7 @@ #include "td/telegram/logevent/LogEvent.h" #include "td/telegram/MessagesManager.h" #include "td/telegram/misc.h" +#include "td/telegram/net/DcId.h" #include "td/telegram/StickersManager.hpp" #include "td/telegram/Td.h" diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index 7ccd71ee..95282c95 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -9,11 +9,13 @@ #include "td/db/binlog/BinlogEvent.h" #include "td/telegram/net/ConnectionCreator.h" +#include "td/telegram/net/DcId.h" #include "td/telegram/net/MtprotoHeader.h" #include "td/telegram/net/NetQuery.h" #include "td/telegram/net/NetQueryDelayer.h" #include "td/telegram/net/NetQueryDispatcher.h" #include "td/telegram/net/NetStatsManager.h" +#include "td/telegram/net/NetType.h" #include "td/telegram/net/TempAuthKeyWatchdog.h" #include "td/telegram/AccessRights.h" diff --git a/td/telegram/TermsOfService.cpp b/td/telegram/TermsOfService.cpp index bc203f9b..f4439a7f 100644 --- a/td/telegram/TermsOfService.cpp +++ b/td/telegram/TermsOfService.cpp @@ -13,6 +13,7 @@ #include "td/utils/buffer.h" #include "td/utils/logging.h" +#include "td/utils/Status.h" namespace td { diff --git a/td/telegram/TermsOfService.h b/td/telegram/TermsOfService.h index 613100d2..8141f7fc 100644 --- a/td/telegram/TermsOfService.h +++ b/td/telegram/TermsOfService.h @@ -15,6 +15,7 @@ #include "td/actor/PromiseFuture.h" #include "td/utils/common.h" +#include "td/utils/Slice.h" #include "td/utils/tl_helpers.h" #include diff --git a/td/telegram/files/FileDownloader.cpp b/td/telegram/files/FileDownloader.cpp index 91aaf99e..cea8ee4f 100644 --- a/td/telegram/files/FileDownloader.cpp +++ b/td/telegram/files/FileDownloader.cpp @@ -10,6 +10,7 @@ #include "td/telegram/files/FileLoaderUtils.h" #include "td/telegram/Global.h" +#include "td/telegram/net/DcId.h" #include "td/telegram/UniqueId.h" #include "td/utils/buffer.h" diff --git a/td/telegram/files/FileDownloader.h b/td/telegram/files/FileDownloader.h index 6a45ca56..f1739632 100644 --- a/td/telegram/files/FileDownloader.h +++ b/td/telegram/files/FileDownloader.h @@ -13,6 +13,7 @@ #include "td/telegram/files/FileLoader.h" #include "td/telegram/files/FileLocation.h" +#include "td/telegram/net/DcId.h" #include "td/telegram/net/NetQuery.h" #include "td/utils/common.h" diff --git a/td/telegram/files/FileHashUploader.cpp b/td/telegram/files/FileHashUploader.cpp index 6af72c91..c4401b4a 100644 --- a/td/telegram/files/FileHashUploader.cpp +++ b/td/telegram/files/FileHashUploader.cpp @@ -9,6 +9,7 @@ #include "td/telegram/telegram_api.h" #include "td/telegram/Global.h" +#include "td/telegram/net/DcId.h" #include "td/telegram/net/NetQueryDispatcher.h" #include "td/utils/buffer.h" diff --git a/td/telegram/files/FileLoadManager.h b/td/telegram/files/FileLoadManager.h index dcc3ead6..7dc92d59 100644 --- a/td/telegram/files/FileLoadManager.h +++ b/td/telegram/files/FileLoadManager.h @@ -15,6 +15,7 @@ #include "td/telegram/files/FileLocation.h" #include "td/telegram/files/FileUploader.h" #include "td/telegram/files/ResourceManager.h" +#include "td/telegram/net/DcId.h" #include "td/utils/buffer.h" #include "td/utils/Container.h" diff --git a/td/telegram/files/FileUploader.cpp b/td/telegram/files/FileUploader.cpp index d583b8f7..0c5c8336 100644 --- a/td/telegram/files/FileUploader.cpp +++ b/td/telegram/files/FileUploader.cpp @@ -11,6 +11,7 @@ #include "td/telegram/files/FileLoaderUtils.h" #include "td/telegram/Global.h" +#include "td/telegram/net/DcId.h" #include "td/telegram/net/NetQueryDispatcher.h" #include "td/utils/buffer.h" diff --git a/td/telegram/net/ConnectionCreator.cpp b/td/telegram/net/ConnectionCreator.cpp index 44d34fc9..421c2303 100644 --- a/td/telegram/net/ConnectionCreator.cpp +++ b/td/telegram/net/ConnectionCreator.cpp @@ -15,6 +15,7 @@ #include "td/telegram/MessagesManager.h" #include "td/telegram/net/MtprotoHeader.h" #include "td/telegram/net/NetQueryDispatcher.h" +#include "td/telegram/net/NetType.h" #include "td/telegram/StateManager.h" #include "td/mtproto/IStreamTransport.h" diff --git a/td/telegram/net/ConnectionCreator.h b/td/telegram/net/ConnectionCreator.h index d38c3ff4..73e6a69c 100644 --- a/td/telegram/net/ConnectionCreator.h +++ b/td/telegram/net/ConnectionCreator.h @@ -9,6 +9,7 @@ #include "td/telegram/td_api.h" #include "td/telegram/telegram_api.h" +#include "td/telegram/net/DcId.h" #include "td/telegram/net/DcOptions.h" #include "td/telegram/net/DcOptionsSet.h" #include "td/telegram/net/NetQuery.h" diff --git a/td/telegram/net/DcAuthManager.h b/td/telegram/net/DcAuthManager.h index 4806a8c8..71c13914 100644 --- a/td/telegram/net/DcAuthManager.h +++ b/td/telegram/net/DcAuthManager.h @@ -8,6 +8,7 @@ #include "td/telegram/Global.h" #include "td/telegram/net/AuthDataShared.h" +#include "td/telegram/net/DcId.h" #include "td/telegram/net/NetQuery.h" #include "td/actor/actor.h" diff --git a/td/telegram/net/DcOptionsSet.h b/td/telegram/net/DcOptionsSet.h index e6d9b699..75e7050a 100644 --- a/td/telegram/net/DcOptionsSet.h +++ b/td/telegram/net/DcOptionsSet.h @@ -6,6 +6,7 @@ // #pragma once +#include "td/telegram/net/DcId.h" #include "td/telegram/net/DcOptions.h" #include "td/utils/Container.h" diff --git a/td/telegram/net/NetQuery.cpp b/td/telegram/net/NetQuery.cpp index 7a228483..d555e612 100644 --- a/td/telegram/net/NetQuery.cpp +++ b/td/telegram/net/NetQuery.cpp @@ -8,6 +8,9 @@ #include "td/telegram/Global.h" +#include "td/utils/misc.h" +#include "td/utils/Slice.h" + namespace td { ListNode net_query_list_; diff --git a/td/telegram/net/NetQueryDispatcher.cpp b/td/telegram/net/NetQueryDispatcher.cpp index 5afb2508..29980c0c 100644 --- a/td/telegram/net/NetQueryDispatcher.cpp +++ b/td/telegram/net/NetQueryDispatcher.cpp @@ -9,6 +9,7 @@ #include "td/telegram/net/DcAuthManager.h" #include "td/telegram/net/NetQuery.h" #include "td/telegram/net/NetQueryDelayer.h" +#include "td/telegram/net/PublicRsaKeyShared.h" #include "td/telegram/net/PublicRsaKeyWatchdog.h" #include "td/telegram/net/SessionMultiProxy.h" diff --git a/td/telegram/net/NetQueryDispatcher.h b/td/telegram/net/NetQueryDispatcher.h index 148ea230..39ae0de0 100644 --- a/td/telegram/net/NetQueryDispatcher.h +++ b/td/telegram/net/NetQueryDispatcher.h @@ -7,6 +7,7 @@ #pragma once #include "td/telegram/net/AuthDataShared.h" +#include "td/telegram/net/DcId.h" #include "td/telegram/net/NetQuery.h" #include "td/actor/actor.h" @@ -23,11 +24,11 @@ namespace td { -class NetQueryDelayer; class DcAuthManager; -class SessionMultiProxy; +class NetQueryDelayer; class PublicRsaKeyShared; class PublicRsaKeyWatchdog; +class SessionMultiProxy; // Not just dispatcher. class NetQueryDispatcher { diff --git a/td/telegram/net/PublicRsaKeyWatchdog.cpp b/td/telegram/net/PublicRsaKeyWatchdog.cpp index 5946fca4..55d3304f 100644 --- a/td/telegram/net/PublicRsaKeyWatchdog.cpp +++ b/td/telegram/net/PublicRsaKeyWatchdog.cpp @@ -7,6 +7,7 @@ #include "td/telegram/net/PublicRsaKeyWatchdog.h" #include "td/telegram/Global.h" +#include "td/telegram/net/DcId.h" #include "td/telegram/telegram_api.h" diff --git a/td/telegram/net/Session.cpp b/td/telegram/net/Session.cpp index 2d1bd8f9..8549ae17 100644 --- a/td/telegram/net/Session.cpp +++ b/td/telegram/net/Session.cpp @@ -13,6 +13,7 @@ #include "td/telegram/net/MtprotoHeader.h" #include "td/telegram/net/NetQuery.h" #include "td/telegram/net/NetQueryDispatcher.h" +#include "td/telegram/net/NetType.h" #include "td/telegram/StateManager.h" #include "td/telegram/UniqueId.h" diff --git a/td/telegram/net/SessionProxy.cpp b/td/telegram/net/SessionProxy.cpp index 360adb7a..f26229c8 100644 --- a/td/telegram/net/SessionProxy.cpp +++ b/td/telegram/net/SessionProxy.cpp @@ -8,6 +8,7 @@ #include "td/telegram/Global.h" #include "td/telegram/net/ConnectionCreator.h" +#include "td/telegram/net/DcId.h" #include "td/telegram/net/NetQueryDispatcher.h" #include "td/telegram/net/Session.h" diff --git a/tdactor/td/actor/PromiseFuture.h b/tdactor/td/actor/PromiseFuture.h index a83d230d..d26c32b7 100644 --- a/tdactor/td/actor/PromiseFuture.h +++ b/tdactor/td/actor/PromiseFuture.h @@ -15,6 +15,8 @@ #include "td/utils/ScopeGuard.h" #include "td/utils/Status.h" +#include +#include #include #include #include @@ -303,7 +305,6 @@ class CancellablePromise : public PromiseT { } virtual bool is_cancellable() const { return true; - ; } virtual bool is_cancelled() const { return cancellation_token_.is_canceled(); diff --git a/tddb/td/db/detail/RawSqliteDb.cpp b/tddb/td/db/detail/RawSqliteDb.cpp index 41b266ad..74ac1a4e 100644 --- a/tddb/td/db/detail/RawSqliteDb.cpp +++ b/tddb/td/db/detail/RawSqliteDb.cpp @@ -9,15 +9,18 @@ #include "sqlite/sqlite3.h" #include "td/utils/common.h" +#include "td/utils/format.h" #include "td/utils/logging.h" #include "td/utils/port/path.h" #include "td/utils/port/Stat.h" namespace td { namespace detail { + Status RawSqliteDb::last_error(sqlite3 *db) { return Status::Error(Slice(sqlite3_errmsg(db))); } + Status RawSqliteDb::destroy(Slice path) { Status error; with_db_path(path, [&](auto path) { @@ -28,6 +31,7 @@ Status RawSqliteDb::destroy(Slice path) { }); return error; } + Status RawSqliteDb::last_error() { //If database was corrupted, try to delete it. auto code = sqlite3_errcode(db_); @@ -37,6 +41,7 @@ Status RawSqliteDb::last_error() { return last_error(db_); } + RawSqliteDb::~RawSqliteDb() { auto rc = sqlite3_close(db_); LOG_IF(FATAL, rc != SQLITE_OK) << last_error(db_); diff --git a/test/mtproto.cpp b/test/mtproto.cpp index 468e2be8..295c9709 100644 --- a/test/mtproto.cpp +++ b/test/mtproto.cpp @@ -19,6 +19,7 @@ #include "td/net/Socks5.h" #include "td/telegram/ConfigManager.h" +#include "td/telegram/net/DcId.h" #include "td/telegram/net/PublicRsaKeyShared.h" #include "td/utils/logging.h"