From f3c052ed0ccd40fcda7ffe7fd62af107184a8a13 Mon Sep 17 00:00:00 2001 From: Vort Date: Thu, 29 Feb 2024 10:27:52 +0200 Subject: [PATCH] write SSU2 socket buffer sizes to log --- libi2pd/SSU2.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/libi2pd/SSU2.cpp b/libi2pd/SSU2.cpp index 3d5eb7e2..b2452fda 100644 --- a/libi2pd/SSU2.cpp +++ b/libi2pd/SSU2.cpp @@ -256,8 +256,27 @@ namespace transport socket.open (localEndpoint.protocol ()); if (localEndpoint.address ().is_v6 ()) socket.set_option (boost::asio::ip::v6_only (true)); - socket.set_option (boost::asio::socket_base::receive_buffer_size (SSU2_SOCKET_RECEIVE_BUFFER_SIZE)); - socket.set_option (boost::asio::socket_base::send_buffer_size (SSU2_SOCKET_SEND_BUFFER_SIZE)); + boost::asio::socket_base::receive_buffer_size receive_buffer_size_set (SSU2_SOCKET_RECEIVE_BUFFER_SIZE); + boost::asio::socket_base::send_buffer_size send_buffer_size_set (SSU2_SOCKET_SEND_BUFFER_SIZE); + socket.set_option (receive_buffer_size_set); + socket.set_option (send_buffer_size_set); + boost::asio::socket_base::receive_buffer_size receive_buffer_size_get; + boost::asio::socket_base::send_buffer_size send_buffer_size_get; + socket.get_option (receive_buffer_size_get); + socket.get_option (send_buffer_size_get); + if (receive_buffer_size_get.value () != receive_buffer_size_set.value () || + send_buffer_size_get.value () != send_buffer_size_set.value ()) + { + LogPrint (eLogWarning, "SSU2: Socket receive buffer size: requested = ", + receive_buffer_size_set.value (), ", got = ", receive_buffer_size_get.value ()); + LogPrint (eLogWarning, "SSU2: Socket send buffer size: requested = ", + send_buffer_size_set.value (), ", got = ", send_buffer_size_get.value ()); + } + else + { + LogPrint (eLogInfo, "SSU2: Socket receive buffer size: ", receive_buffer_size_get.value ()); + LogPrint (eLogInfo, "SSU2: Socket send buffer size: ", send_buffer_size_get.value ()); + } socket.non_blocking (true); } catch (std::exception& ex )