From 73e01f63612a4e7da66c9851a2ffcaa3eddad005 Mon Sep 17 00:00:00 2001 From: Oleg Baranov Date: Wed, 26 Feb 2025 14:39:18 +0400 Subject: [PATCH] Bigger batch for tunnel write to debug --- README.md | 16 ++++++++++++++++ tdnet/td/net/UdpServer.cpp | 8 +++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 897ba809..32f0f4fe 100644 --- a/README.md +++ b/README.md @@ -149,3 +149,19 @@ Linux and MacOS binaries are available for both x86-64 and arm64 architectures. ## Running tests Tests are executed by running `ctest` in the build directory. See `doc/Tests.md` for more information. + +## Using ADNL tunnel + +### Before node compilation +1. Clone https://github.com/ton-blockchain/adnl-tunnel and install golang 1.23 or newer + * `cd adnl-tunnel` + * `make library` + * It will build `libtunnel.a` +2. Copy `libtunnel.a` to ton src directory root (usually `/usr/src/ton`) +3. On the first step of ton node compilation run cmake with option `-DTON_USE_GO_TUNNEL=ON` to enable tunnel. +4. Build ton node as usual. + +### Before startup +1. Create `tunnel-config.json` in any place. +2. Fill it with desired tunnel configuration and wallet keys. See example. +3Add `--tunnel-config /path/to/tunnel-config.json` argument to validator-engine startup command. \ No newline at end of file diff --git a/tdnet/td/net/UdpServer.cpp b/tdnet/td/net/UdpServer.cpp index d2991982..43c44f0f 100644 --- a/tdnet/td/net/UdpServer.cpp +++ b/tdnet/td/net/UdpServer.cpp @@ -46,7 +46,7 @@ class UdpServerTunnelImpl : public UdpServer { private: td::Promise on_ready_; - uint8_t out_buf_[(16+2+1500)*100]; + uint8_t out_buf_[(16+2+1500)*300]; size_t out_buf_offset_ = 0; size_t out_buf_msg_num_ = 0; size_t tunnel_index_; @@ -85,8 +85,10 @@ void UdpServerTunnelImpl::send(td::UdpMessage &&message) { out_buf_msg_num_++; - if (out_buf_msg_num_ == 3) { + if (out_buf_msg_num_ == 300) { + td::Timer timer; WriteTunnel(tunnel_index_, out_buf_, out_buf_msg_num_); + LOG(ERROR) << "Sending messages by num " << out_buf_msg_num_ << " | " << timer.elapsed(); out_buf_offset_ = 0; out_buf_msg_num_ = 0; @@ -98,7 +100,7 @@ void UdpServerTunnelImpl::alarm() { if (out_buf_msg_num_ > 0 && Time::now()-last_batch_at_ >= 0.02) { td::Timer timer; WriteTunnel(tunnel_index_, out_buf_, out_buf_msg_num_); - // LOG(ERROR) << "Sending messages from alarm " << out_buf_msg_num_ << " | " << timer.elapsed(); + LOG(ERROR) << "Sending messages from alarm " << out_buf_msg_num_ << " | " << timer.elapsed(); out_buf_offset_ = 0; out_buf_msg_num_ = 0;