Browse Source

fix warnings about unused code

Signed-off-by: R4SAS <r4sas@i2pmail.org>
pull/1833/head
R4SAS 2 years ago
parent
commit
2c19da9aa7
Signed by: r4sas
GPG Key ID: 66F6C87B98EBCFE2
  1. 8
      daemon/HTTPServer.cpp
  2. 2
      libi2pd/Blinding.cpp
  3. 2
      libi2pd/Crypto.cpp
  4. 34
      libi2pd/NTCP2.cpp
  5. 2
      libi2pd_client/SOCKS.cpp

8
daemon/HTTPServer.cpp

@ -87,8 +87,6 @@ namespace http {
const char HTTP_COMMAND_GET_REG_STRING[] = "get_reg_string"; const char HTTP_COMMAND_GET_REG_STRING[] = "get_reg_string";
const char HTTP_COMMAND_SETLANGUAGE[] = "setlanguage"; const char HTTP_COMMAND_SETLANGUAGE[] = "setlanguage";
const char HTTP_COMMAND_RELOAD_CSS[] = "reload_css"; 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) static std::string ConvertTime (uint64_t time)
{ {
@ -301,7 +299,7 @@ namespace http {
if ((outputFormat == OutputFormatEnum::forWebConsole) || !includeHiddenContent) { if ((outputFormat == OutputFormatEnum::forWebConsole) || !includeHiddenContent) {
s << "<label for=\"slide-info\">" << tr("Hidden content. Press on text to see.") << "</label>\r\n<input type=\"checkbox\" id=\"slide-info\" />\r\n<div class=\"slidecontent\">\r\n"; s << "<label for=\"slide-info\">" << tr("Hidden content. Press on text to see.") << "</label>\r\n<input type=\"checkbox\" id=\"slide-info\" />\r\n<div class=\"slidecontent\">\r\n";
} }
if (includeHiddenContent) if (includeHiddenContent)
{ {
s << "<b>" << tr("Router Ident") << ":</b> " << i2p::context.GetRouterInfo().GetIdentHashBase64() << "<br>\r\n"; s << "<b>" << tr("Router Ident") << ":</b> " << i2p::context.GetRouterInfo().GetIdentHashBase64() << "<br>\r\n";
if (!i2p::context.GetRouterInfo().GetProperty("family").empty()) if (!i2p::context.GetRouterInfo().GetProperty("family").empty())
@ -311,7 +309,7 @@ namespace http {
s << "<b>"<< tr("Our external address") << ":</b>" << "<br>\r\n<table class=\"extaddr\"><tbody>\r\n"; s << "<b>"<< tr("Our external address") << ":</b>" << "<br>\r\n<table class=\"extaddr\"><tbody>\r\n";
auto addresses = i2p::context.GetRouterInfo().GetAddresses (); auto addresses = i2p::context.GetRouterInfo().GetAddresses ();
if (addresses) if (addresses)
{ {
for (const auto& address : *addresses) for (const auto& address : *addresses)
{ {
if (!address) continue; if (!address) continue;
@ -344,7 +342,7 @@ namespace http {
} }
s << "</tr>\r\n"; s << "</tr>\r\n";
} }
} }
s << "</tbody></table>\r\n"; s << "</tbody></table>\r\n";
} }
s << "</div>\r\n</div>\r\n"; s << "</div>\r\n</div>\r\n";

2
libi2pd/Blinding.cpp

@ -135,7 +135,7 @@ namespace data
//---------------------------------------------------------- //----------------------------------------------------------
const uint8_t B33_TWO_BYTES_SIGTYPE_FLAG = 0x01; 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; const uint8_t B33_PER_CLIENT_AUTH_FLAG = 0x04;
BlindedPublicKey::BlindedPublicKey (std::shared_ptr<const IdentityEx> identity, bool clientAuth): BlindedPublicKey::BlindedPublicKey (std::shared_ptr<const IdentityEx> identity, bool clientAuth):

2
libi2pd/Crypto.cpp

@ -159,8 +159,10 @@ namespace crypto
// DH/ElGamal // DH/ElGamal
#if !defined(__x86_64__)
const int ELGAMAL_SHORT_EXPONENT_NUM_BITS = 226; const int ELGAMAL_SHORT_EXPONENT_NUM_BITS = 226;
const int ELGAMAL_SHORT_EXPONENT_NUM_BYTES = ELGAMAL_SHORT_EXPONENT_NUM_BITS/8+1; 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_BITS = 2048;
const int ELGAMAL_FULL_EXPONENT_NUM_BYTES = ELGAMAL_FULL_EXPONENT_NUM_BITS/8; const int ELGAMAL_FULL_EXPONENT_NUM_BYTES = ELGAMAL_FULL_EXPONENT_NUM_BITS/8;

34
libi2pd/NTCP2.cpp

@ -1453,17 +1453,17 @@ namespace transport
LogPrint (eLogError, "NTCP2: Connected from error ", ec.message ()); LogPrint (eLogError, "NTCP2: Connected from error ", ec.message ());
} }
else else
{ {
LogPrint (eLogError, "NTCP2: Accept error ", error.message ()); LogPrint (eLogError, "NTCP2: Accept error ", error.message ());
if (error == boost::asio::error::no_descriptors) if (error == boost::asio::error::no_descriptors)
{ {
i2p::context.SetError (eRouterErrorNoDescriptors); i2p::context.SetError (eRouterErrorNoDescriptors);
return; return;
} }
} }
if (error != boost::asio::error::operation_aborted) if (error != boost::asio::error::operation_aborted)
{ {
if (!conn) // connection is used, create new one if (!conn) // connection is used, create new one
conn = std::make_shared<NTCP2Session> (*this); conn = std::make_shared<NTCP2Session> (*this);
else // reuse failed else // reuse failed
@ -1504,14 +1504,14 @@ namespace transport
LogPrint (eLogError, "NTCP2: Connected from error ", ec.message ()); LogPrint (eLogError, "NTCP2: Connected from error ", ec.message ());
} }
else else
{ {
LogPrint (eLogError, "NTCP2: Accept ipv6 error ", error.message ()); LogPrint (eLogError, "NTCP2: Accept ipv6 error ", error.message ());
if (error == boost::asio::error::no_descriptors) if (error == boost::asio::error::no_descriptors)
{ {
i2p::context.SetErrorV6 (eRouterErrorNoDescriptors); i2p::context.SetErrorV6 (eRouterErrorNoDescriptors);
return; return;
} }
} }
if (error != boost::asio::error::operation_aborted) if (error != boost::asio::error::operation_aborted)
{ {
@ -1560,23 +1560,23 @@ namespace transport
it++; it++;
} }
ScheduleTermination (); ScheduleTermination ();
// try to restart acceptors if no description // 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) if (i2p::context.GetError () == eRouterErrorNoDescriptors)
{ {
i2p::context.SetError (eRouterErrorNone); i2p::context.SetError (eRouterErrorNone);
auto conn = std::make_shared<NTCP2Session> (*this); auto conn = std::make_shared<NTCP2Session> (*this);
m_NTCP2Acceptor->async_accept(conn->GetSocket (), std::bind (&NTCP2Server::HandleAccept, this, m_NTCP2Acceptor->async_accept(conn->GetSocket (), std::bind (&NTCP2Server::HandleAccept, this,
conn, std::placeholders::_1)); conn, std::placeholders::_1));
} }
if (i2p::context.GetErrorV6 () == eRouterErrorNoDescriptors) if (i2p::context.GetErrorV6 () == eRouterErrorNoDescriptors)
{ {
i2p::context.SetErrorV6 (eRouterErrorNone); i2p::context.SetErrorV6 (eRouterErrorNone);
auto conn = std::make_shared<NTCP2Session> (*this); auto conn = std::make_shared<NTCP2Session> (*this);
m_NTCP2V6Acceptor->async_accept(conn->GetSocket (), std::bind (&NTCP2Server::HandleAcceptV6, this, m_NTCP2V6Acceptor->async_accept(conn->GetSocket (), std::bind (&NTCP2Server::HandleAcceptV6, this,
conn, std::placeholders::_1)); 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::async_read(conn->GetSocket(), boost::asio::buffer(readbuff->data (), SOCKS5_UDP_IPV4_REQUEST_HEADER_SIZE), // read min reply size
boost::asio::transfer_all(), boost::asio::transfer_all(),
[timer, conn, sz, readbuff](const boost::system::error_code & e, std::size_t transferred) [timer, conn, readbuff](const boost::system::error_code & e, std::size_t transferred)
{ {
if (e) if (e)
LogPrint(eLogError, "NTCP2: SOCKS proxy read error ", e.message()); LogPrint(eLogError, "NTCP2: SOCKS proxy read error ", e.message());
else if (!(*readbuff)[1]) // succeeded else if (!(*readbuff)[1]) // succeeded
{ {
boost::system::error_code ec; 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 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); boost::asio::read (conn->GetSocket (), boost::asio::buffer(readbuff->data (), moreBytes), boost::asio::transfer_all (), ec);
timer->cancel(); timer->cancel();

2
libi2pd_client/SOCKS.cpp

@ -27,7 +27,7 @@ namespace proxy
static const size_t socks_buffer_size = 8192; 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 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; static const size_t SOCKS_UPSTREAM_SOCKS4A_REPLY_SIZE = 8;

Loading…
Cancel
Save