diff --git a/daemon/HTTPServer.cpp b/daemon/HTTPServer.cpp index 1f7f75da..7c62418e 100644 --- a/daemon/HTTPServer.cpp +++ b/daemon/HTTPServer.cpp @@ -87,8 +87,6 @@ namespace http { const char HTTP_COMMAND_GET_REG_STRING[] = "get_reg_string"; const char HTTP_COMMAND_SETLANGUAGE[] = "setlanguage"; const char HTTP_COMMAND_RELOAD_CSS[] = "reload_css"; - const char HTTP_PARAM_SAM_SESSION_ID[] = "id"; - const char HTTP_PARAM_ADDRESS[] = "address"; static std::string ConvertTime (uint64_t time) { @@ -301,7 +299,7 @@ namespace http { if ((outputFormat == OutputFormatEnum::forWebConsole) || !includeHiddenContent) { s << "\r\n\r\n
\r\n"; } - if (includeHiddenContent) + if (includeHiddenContent) { s << "" << tr("Router Ident") << ": " << i2p::context.GetRouterInfo().GetIdentHashBase64() << "
\r\n"; if (!i2p::context.GetRouterInfo().GetProperty("family").empty()) @@ -311,7 +309,7 @@ namespace http { s << ""<< tr("Our external address") << ":" << "
\r\n\r\n"; auto addresses = i2p::context.GetRouterInfo().GetAddresses (); if (addresses) - { + { for (const auto& address : *addresses) { if (!address) continue; @@ -344,7 +342,7 @@ namespace http { } s << "\r\n"; } - } + } s << "
\r\n"; } s << "
\r\n\r\n"; diff --git a/libi2pd/Blinding.cpp b/libi2pd/Blinding.cpp index 65e5f78c..ced086e1 100644 --- a/libi2pd/Blinding.cpp +++ b/libi2pd/Blinding.cpp @@ -135,7 +135,7 @@ namespace data //---------------------------------------------------------- const uint8_t B33_TWO_BYTES_SIGTYPE_FLAG = 0x01; - const uint8_t B33_PER_SECRET_FLAG = 0x02; // not used for now + // const uint8_t B33_PER_SECRET_FLAG = 0x02; // not used for now const uint8_t B33_PER_CLIENT_AUTH_FLAG = 0x04; BlindedPublicKey::BlindedPublicKey (std::shared_ptr identity, bool clientAuth): diff --git a/libi2pd/Crypto.cpp b/libi2pd/Crypto.cpp index b152cdd0..c9670f6c 100644 --- a/libi2pd/Crypto.cpp +++ b/libi2pd/Crypto.cpp @@ -159,8 +159,10 @@ namespace crypto // DH/ElGamal +#if !defined(__x86_64__) const int ELGAMAL_SHORT_EXPONENT_NUM_BITS = 226; const int ELGAMAL_SHORT_EXPONENT_NUM_BYTES = ELGAMAL_SHORT_EXPONENT_NUM_BITS/8+1; +#endif const int ELGAMAL_FULL_EXPONENT_NUM_BITS = 2048; const int ELGAMAL_FULL_EXPONENT_NUM_BYTES = ELGAMAL_FULL_EXPONENT_NUM_BITS/8; diff --git a/libi2pd/NTCP2.cpp b/libi2pd/NTCP2.cpp index 4fa55f90..b85ba1e4 100644 --- a/libi2pd/NTCP2.cpp +++ b/libi2pd/NTCP2.cpp @@ -1453,17 +1453,17 @@ namespace transport LogPrint (eLogError, "NTCP2: Connected from error ", ec.message ()); } else - { + { LogPrint (eLogError, "NTCP2: Accept error ", error.message ()); if (error == boost::asio::error::no_descriptors) { i2p::context.SetError (eRouterErrorNoDescriptors); - return; - } - } - + return; + } + } + if (error != boost::asio::error::operation_aborted) - { + { if (!conn) // connection is used, create new one conn = std::make_shared (*this); else // reuse failed @@ -1504,14 +1504,14 @@ namespace transport LogPrint (eLogError, "NTCP2: Connected from error ", ec.message ()); } else - { + { LogPrint (eLogError, "NTCP2: Accept ipv6 error ", error.message ()); if (error == boost::asio::error::no_descriptors) { i2p::context.SetErrorV6 (eRouterErrorNoDescriptors); - return; - } - } + return; + } + } if (error != boost::asio::error::operation_aborted) { @@ -1560,23 +1560,23 @@ namespace transport it++; } ScheduleTermination (); - + // try to restart acceptors if no description - // we do it after timer to let timer take descriptor first + // we do it after timer to let timer take descriptor first if (i2p::context.GetError () == eRouterErrorNoDescriptors) { i2p::context.SetError (eRouterErrorNone); auto conn = std::make_shared (*this); m_NTCP2Acceptor->async_accept(conn->GetSocket (), std::bind (&NTCP2Server::HandleAccept, this, conn, std::placeholders::_1)); - } + } if (i2p::context.GetErrorV6 () == eRouterErrorNoDescriptors) { i2p::context.SetErrorV6 (eRouterErrorNone); auto conn = std::make_shared (*this); m_NTCP2V6Acceptor->async_accept(conn->GetSocket (), std::bind (&NTCP2Server::HandleAcceptV6, this, conn, std::placeholders::_1)); - } + } } } @@ -1784,15 +1784,15 @@ namespace transport }); boost::asio::async_read(conn->GetSocket(), boost::asio::buffer(readbuff->data (), SOCKS5_UDP_IPV4_REQUEST_HEADER_SIZE), // read min reply size - boost::asio::transfer_all(), - [timer, conn, sz, readbuff](const boost::system::error_code & e, std::size_t transferred) + boost::asio::transfer_all(), + [timer, conn, readbuff](const boost::system::error_code & e, std::size_t transferred) { if (e) LogPrint(eLogError, "NTCP2: SOCKS proxy read error ", e.message()); else if (!(*readbuff)[1]) // succeeded { boost::system::error_code ec; - size_t moreBytes = conn->GetSocket ().available(ec); + size_t moreBytes = conn->GetSocket ().available(ec); if (moreBytes) // read remaining portion of reply if ipv6 received boost::asio::read (conn->GetSocket (), boost::asio::buffer(readbuff->data (), moreBytes), boost::asio::transfer_all (), ec); timer->cancel(); diff --git a/libi2pd_client/SOCKS.cpp b/libi2pd_client/SOCKS.cpp index 961ff934..ca87e22a 100644 --- a/libi2pd_client/SOCKS.cpp +++ b/libi2pd_client/SOCKS.cpp @@ -27,7 +27,7 @@ namespace proxy static const size_t socks_buffer_size = 8192; static const size_t max_socks_hostname_size = 255; // Limit for socks5 and bad idea to traverse - static const size_t SOCKS_FORWARDER_BUFFER_SIZE = 8192; + //static const size_t SOCKS_FORWARDER_BUFFER_SIZE = 8192; static const size_t SOCKS_UPSTREAM_SOCKS4A_REPLY_SIZE = 8;