diff --git a/td/mtproto/CryptoStorer.h b/td/mtproto/CryptoStorer.h index 03558e569..ebc8178a3 100644 --- a/td/mtproto/CryptoStorer.h +++ b/td/mtproto/CryptoStorer.h @@ -25,6 +25,7 @@ class msg_container { static const int32 ID = 0x73f1f8dc; }; } // namespace mtproto_api + namespace mtproto { template diff --git a/td/mtproto/Handshake.h b/td/mtproto/Handshake.h index 7ed919067..750b00b44 100644 --- a/td/mtproto/Handshake.h +++ b/td/mtproto/Handshake.h @@ -17,7 +17,6 @@ #include "td/utils/UInt.h" namespace td { - namespace mtproto { class AuthKeyHandshakeContext { diff --git a/td/mtproto/HandshakeActor.cpp b/td/mtproto/HandshakeActor.cpp index 5f985ce49..fb4e0832a 100644 --- a/td/mtproto/HandshakeActor.cpp +++ b/td/mtproto/HandshakeActor.cpp @@ -14,6 +14,7 @@ namespace td { namespace mtproto { + HandshakeActor::HandshakeActor(unique_ptr handshake, unique_ptr raw_connection, unique_ptr context, double timeout, Promise> raw_connection_promise, @@ -86,5 +87,6 @@ void HandshakeActor::return_handshake() { } handshake_promise_.set_value(std::move(handshake_)); } + } // namespace mtproto } // namespace td diff --git a/td/mtproto/Ping.h b/td/mtproto/Ping.h index 699d6748a..fa670d2a7 100644 --- a/td/mtproto/Ping.h +++ b/td/mtproto/Ping.h @@ -20,5 +20,5 @@ namespace mtproto { ActorOwn<> create_ping_actor(string debug, unique_ptr raw_connection, unique_ptr auth_data, Promise> promise, ActorShared<> parent); -} +} // namespace mtproto } // namespace td diff --git a/td/mtproto/TcpTransport.cpp b/td/mtproto/TcpTransport.cpp index a300fd3cf..d9c75b65a 100644 --- a/td/mtproto/TcpTransport.cpp +++ b/td/mtproto/TcpTransport.cpp @@ -16,6 +16,7 @@ namespace td { namespace mtproto { namespace tcp { + size_t IntermediateTransport::read_from_stream(ChainBufferReader *stream, BufferSlice *message, uint32 *quick_ack) { CHECK(message); size_t stream_size = stream->size(); diff --git a/td/mtproto/TlsInit.cpp b/td/mtproto/TlsInit.cpp index 033bf6843..8577003b9 100644 --- a/td/mtproto/TlsInit.cpp +++ b/td/mtproto/TlsInit.cpp @@ -16,6 +16,7 @@ #include namespace td { +namespace mtproto { void Grease::init(MutableSlice res) { Random::secure_bytes(res); @@ -400,4 +401,5 @@ Status TlsInit::loop_impl() { return Status::OK(); } +} // namespace mtproto } // namespace td diff --git a/td/mtproto/TlsInit.h b/td/mtproto/TlsInit.h index 92d075482..79069e241 100644 --- a/td/mtproto/TlsInit.h +++ b/td/mtproto/TlsInit.h @@ -12,6 +12,7 @@ #include "td/utils/Status.h" namespace td { +namespace mtproto { class Grease { public: @@ -41,4 +42,5 @@ class TlsInit : public TransparentProxy { Status loop_impl() override; }; +} // namespace mtproto } // namespace td diff --git a/td/mtproto/TlsReaderByteFlow.cpp b/td/mtproto/TlsReaderByteFlow.cpp index 2ed6295e0..0a656650b 100644 --- a/td/mtproto/TlsReaderByteFlow.cpp +++ b/td/mtproto/TlsReaderByteFlow.cpp @@ -9,6 +9,7 @@ #include "td/utils/Status.h" namespace td { +namespace mtproto { void TlsReaderByteFlow::loop() { while (true) { @@ -36,4 +37,5 @@ void TlsReaderByteFlow::loop() { } } +} // namespace mtproto } // namespace td diff --git a/td/mtproto/TlsReaderByteFlow.h b/td/mtproto/TlsReaderByteFlow.h index f85fc8a75..8fe205bc3 100644 --- a/td/mtproto/TlsReaderByteFlow.h +++ b/td/mtproto/TlsReaderByteFlow.h @@ -9,10 +9,12 @@ #include "td/utils/ByteFlow.h" namespace td { +namespace mtproto { class TlsReaderByteFlow final : public ByteFlowBase { public: void loop() override; }; +} // namespace mtproto } // namespace td diff --git a/td/telegram/net/AuthDataShared.cpp b/td/telegram/net/AuthDataShared.cpp index 8a9a83683..e00838f6f 100644 --- a/td/telegram/net/AuthDataShared.cpp +++ b/td/telegram/net/AuthDataShared.cpp @@ -117,4 +117,5 @@ std::shared_ptr AuthDataShared::create(DcId dc_id, std::shared_p std::shared_ptr guard) { return std::make_shared(dc_id, std::move(public_rsa_key), std::move(guard)); } + } // namespace td diff --git a/td/telegram/net/AuthDataShared.h b/td/telegram/net/AuthDataShared.h index a4794eb7d..cfd55d33c 100644 --- a/td/telegram/net/AuthDataShared.h +++ b/td/telegram/net/AuthDataShared.h @@ -20,6 +20,7 @@ #include namespace td { + enum class AuthState : int32 { Empty, KeyNoAuth, OK }; inline StringBuilder &operator<<(StringBuilder &sb, AuthState state) { diff --git a/td/telegram/net/ConnectionCreator.cpp b/td/telegram/net/ConnectionCreator.cpp index 3dadfb459..66f1802bd 100644 --- a/td/telegram/net/ConnectionCreator.cpp +++ b/td/telegram/net/ConnectionCreator.cpp @@ -475,10 +475,10 @@ void ConnectionCreator::ping_proxy_resolved(int32 proxy_id, IPAddress ip_address proxy.proxy().user().str(), proxy.proxy().password().str(), std::move(callback), create_reference(token))}; } else if (secret.emulate_tls()) { - children_[token] = { - false, create_actor("PingTlsInit", std::move(socket_fd), extra.mtproto_ip, secret.get_domain(), - secret.get_proxy_secret().str(), std::move(callback), create_reference(token), - G()->get_dns_time_difference())}; + children_[token] = {false, create_actor("PingTlsInit", std::move(socket_fd), extra.mtproto_ip, + secret.get_domain(), secret.get_proxy_secret().str(), + std::move(callback), create_reference(token), + G()->get_dns_time_difference())}; } else { UNREACHABLE(); } @@ -968,9 +968,9 @@ void ConnectionCreator::client_loop(ClientInfo &client) { std::move(callback), create_reference(token))}; } else if (secret.emulate_tls()) { children_[token] = { - true, create_actor("TlsInit", std::move(socket_fd), extra.mtproto_ip, secret.get_domain(), - secret.get_proxy_secret().str(), std::move(callback), create_reference(token), - G()->get_dns_time_difference())}; + true, create_actor("TlsInit", std::move(socket_fd), extra.mtproto_ip, secret.get_domain(), + secret.get_proxy_secret().str(), std::move(callback), + create_reference(token), G()->get_dns_time_difference())}; } else { UNREACHABLE(); } diff --git a/td/telegram/net/DcAuthManager.cpp b/td/telegram/net/DcAuthManager.cpp index 1d8d33d67..192ad366e 100644 --- a/td/telegram/net/DcAuthManager.cpp +++ b/td/telegram/net/DcAuthManager.cpp @@ -245,4 +245,5 @@ void DcAuthManager::loop() { dc_loop(dc); } } + } // namespace td diff --git a/td/telegram/net/NetQueryCounter.h b/td/telegram/net/NetQueryCounter.h index 2e7b3997e..7b3187f25 100644 --- a/td/telegram/net/NetQueryCounter.h +++ b/td/telegram/net/NetQueryCounter.h @@ -52,4 +52,5 @@ class NetQueryCounter { private: bool is_alive_; }; + } // namespace td diff --git a/td/telegram/net/NetQueryDispatcher.cpp b/td/telegram/net/NetQueryDispatcher.cpp index 7f5172d29..fc0deaded 100644 --- a/td/telegram/net/NetQueryDispatcher.cpp +++ b/td/telegram/net/NetQueryDispatcher.cpp @@ -6,6 +6,7 @@ // #include "td/telegram/net/NetQueryDispatcher.h" +#include "td/telegram/net/AuthDataShared.h" #include "td/telegram/net/DcAuthManager.h" #include "td/telegram/net/NetQuery.h" #include "td/telegram/net/NetQueryDelayer.h" diff --git a/td/telegram/net/NetQueryDispatcher.h b/td/telegram/net/NetQueryDispatcher.h index 7f0f75c07..8f78eb5c6 100644 --- a/td/telegram/net/NetQueryDispatcher.h +++ b/td/telegram/net/NetQueryDispatcher.h @@ -6,7 +6,6 @@ // #pragma once -#include "td/telegram/net/AuthDataShared.h" #include "td/telegram/net/DcId.h" #include "td/telegram/net/NetQuery.h" diff --git a/td/telegram/net/NetStatsManager.h b/td/telegram/net/NetStatsManager.h index 74bcb34ae..4a7665588 100644 --- a/td/telegram/net/NetStatsManager.h +++ b/td/telegram/net/NetStatsManager.h @@ -143,6 +143,7 @@ class NetStatsManager : public Actor { void on_stats_updated(size_t id); void on_net_type_updated(NetType net_type); }; + } // namespace td /* diff --git a/td/telegram/net/PublicRsaKeyWatchdog.cpp b/td/telegram/net/PublicRsaKeyWatchdog.cpp index e28fa8ad6..306b0947a 100644 --- a/td/telegram/net/PublicRsaKeyWatchdog.cpp +++ b/td/telegram/net/PublicRsaKeyWatchdog.cpp @@ -118,4 +118,5 @@ void PublicRsaKeyWatchdog::sync_key(std::shared_ptr &key) { } } } + } // namespace td diff --git a/test/mtproto.cpp b/test/mtproto.cpp index 54529fbc9..fee85f048 100644 --- a/test/mtproto.cpp +++ b/test/mtproto.cpp @@ -592,7 +592,7 @@ RegisterTest mtproto_fastping("Mtproto_FastPing"); TEST(Mtproto, Grease) { std::string s(10000, '0'); - Grease::init(s); + mtproto::Grease::init(s); for (auto c : s) { CHECK((c & 0xF) == 0xA); } @@ -625,8 +625,8 @@ TEST(Mtproto, TlsTransport) { IPAddress ip_address; ip_address.init_host_port(domain, 443).ensure(); SocketFd fd = SocketFd::open(ip_address).move_as_ok(); - create_actor("TlsInit", std::move(fd), IPAddress(), domain, "0123456789secret", - make_unique(), ActorShared<>(), Clocks::system() - Time::now()) + create_actor("TlsInit", std::move(fd), IPAddress(), domain, "0123456789secret", + make_unique(), ActorShared<>(), Clocks::system() - Time::now()) .release(); } };