From d025ba279334a718d3f62be1c59fbe4d90e096e2 Mon Sep 17 00:00:00 2001 From: alexandr Date: Mon, 26 Sep 2016 01:37:00 +0500 Subject: [PATCH 01/24] Fixed visibility of variable outboundTunnel --- I2CP.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/I2CP.cpp b/I2CP.cpp index 0352cd15..41f81155 100644 --- a/I2CP.cpp +++ b/I2CP.cpp @@ -109,7 +109,7 @@ namespace client } else { - auto outboundTunnel = GetTunnelPool ()->GetNextOutboundTunnel (); + outboundTunnel = GetTunnelPool ()->GetNextOutboundTunnel (); auto leases = remote->GetNonExpiredLeases (); if (!leases.empty ()) remoteLease = leases[rand () % leases.size ()]; From f79ad91a9a271058e8a6dc40d80f855e8999be3d Mon Sep 17 00:00:00 2001 From: alexandr Date: Mon, 3 Oct 2016 20:01:31 +0500 Subject: [PATCH 02/24] probably fix hanging of call I2CP-SendMsgTo-FindLeaseSet --- Destination.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Destination.cpp b/Destination.cpp index 48717f5f..f06c7711 100644 --- a/Destination.cpp +++ b/Destination.cpp @@ -171,7 +171,7 @@ namespace client std::shared_ptr LeaseSetDestination::FindLeaseSet (const i2p::data::IdentHash& ident) { - std::lock_guard lock(m_RemoteLeaseSetsMutex); + std::unique_lock lock(m_RemoteLeaseSetsMutex); auto it = m_RemoteLeaseSets.find (ident); if (it != m_RemoteLeaseSets.end ()) { @@ -186,7 +186,6 @@ namespace client { ls->PopulateLeases(); { - std::lock_guard _lock(m_RemoteLeaseSetsMutex); m_RemoteLeaseSets[ident] = ls; } } @@ -203,15 +202,12 @@ namespace client if (ls && !ls->IsExpired ()) { ls->PopulateLeases (); // since we don't store them in netdb - { - std::lock_guard lock(m_RemoteLeaseSetsMutex); - m_RemoteLeaseSets[ident] = ls; - } + m_RemoteLeaseSets[ident] = ls; return ls; } } return nullptr; - } + } std::shared_ptr LeaseSetDestination::GetLeaseSet () { From 8ff2627e8eef895bc840d335aeca5db947077d79 Mon Sep 17 00:00:00 2001 From: alexandr Date: Mon, 3 Oct 2016 20:06:10 +0500 Subject: [PATCH 03/24] minimize count of errors "I2CP: Failed to send message. No outbound tunnels" --- I2CP.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/I2CP.cpp b/I2CP.cpp index e0139b9f..04f21408 100644 --- a/I2CP.cpp +++ b/I2CP.cpp @@ -103,7 +103,8 @@ namespace client } auto path = remoteSession->GetSharedRoutingPath (); std::shared_ptr outboundTunnel; - std::shared_ptr remoteLease; + std::shared_ptr remoteLease; + bool unconfirmedTags=false; if (path) { if (!remoteSession->CleanupUnconfirmedTags ()) // no stuck tags @@ -112,9 +113,12 @@ namespace client remoteLease = path->remoteLease; } else + { remoteSession->SetSharedRoutingPath (nullptr); + unconfirmedTags=true; + } } - else + if (!path || unconfirmedTags) { outboundTunnel = GetTunnelPool ()->GetNextOutboundTunnel (); auto leases = remote->GetNonExpiredLeases (); From 31dde394ebff8e08f00d515722e2508d065867b1 Mon Sep 17 00:00:00 2001 From: alexandr Date: Mon, 3 Oct 2016 20:20:45 +0500 Subject: [PATCH 04/24] remove unnecessary brackets --- Destination.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Destination.cpp b/Destination.cpp index f06c7711..dbdec0c7 100644 --- a/Destination.cpp +++ b/Destination.cpp @@ -185,9 +185,7 @@ namespace client if(ls && !ls->IsExpired()) { ls->PopulateLeases(); - { - m_RemoteLeaseSets[ident] = ls; - } + m_RemoteLeaseSets[ident] = ls; } }); } From 404715e02d4b565d0f8869c80f0e20094d8f97ba Mon Sep 17 00:00:00 2001 From: brain5lug Date: Mon, 3 Oct 2016 23:24:22 +0300 Subject: [PATCH 05/24] thread sanitizer configuration option have been added --- build/CMakeLists.txt | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/build/CMakeLists.txt b/build/CMakeLists.txt index 95f223ef..00048942 100644 --- a/build/CMakeLists.txt +++ b/build/CMakeLists.txt @@ -16,7 +16,8 @@ option(WITH_UPNP "Include support for UPnP client" OFF) option(WITH_PCH "Use precompiled header" OFF) option(WITH_GUI "Include GUI (currently MS Windows only)" ON) option(WITH_MESHNET "Build for cjdns test network" OFF) -option(WITH_ADDRSANITIZER "Build with address sanitizer (linux only)" OFF) +option(WITH_ADDRSANITIZER "Build with address sanitizer unix only" OFF) +option(WITH_THREADSANITIZER "Build with thread sanitizer unix only" OFF) # paths set ( CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules" ) @@ -190,10 +191,22 @@ if (WITH_ADDRSANITIZER) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer" ) set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address" ) else () - error ("MSVC does not support address sanitizer option") + message( SEND_ERROR "MSVC does not support address sanitizer option") endif() endif() +if (WITH_THREADSANITIZER) + if (WITH_ADDRSANITIZER) + message( FATAL_ERROR "thread sanitizer option cannot be combined with address sanitizer") + elseif (NOT MSVC) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread" ) + set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=thread" ) + else () + message( SEND_ERROR "MSVC does not support address sanitizer option") + endif() +endif() + + # libraries # TODO: once CMake 3.1+ becomes mainstream, see e.g. http://stackoverflow.com/a/29871891/673826 # use imported Threads::Threads instead @@ -347,6 +360,7 @@ message(STATUS " UPnP : ${WITH_UPNP}") message(STATUS " PCH : ${WITH_PCH}") message(STATUS " MESHNET : ${WITH_MESHNET}") message(STATUS " ADDRSANITIZER : ${WITH_ADDRSANITIZER}") +message(STATUS " THEADSANITIZER : ${WITH_THREADSANITIZER}") message(STATUS "---------------------------------------") #Handle paths nicely From 5350078543d0ac04a608f2c03efd4b9e1b8f9509 Mon Sep 17 00:00:00 2001 From: brain5lug Date: Tue, 4 Oct 2016 00:24:42 +0300 Subject: [PATCH 06/24] Unused parameter warnings removal --- AddressBook.cpp | 3 ++- BOB.cpp | 42 +++++++++++++++++++++--------------------- Destination.cpp | 6 +++--- Family.cpp | 2 +- I2CP.cpp | 15 ++++++++------- I2PControl.cpp | 8 ++++---- I2PTunnel.cpp | 5 +++-- LeaseSet.cpp | 2 +- RouterContext.cpp | 2 +- SAM.cpp | 15 ++++++++------- SOCKS.cpp | 4 ++-- SSUSession.cpp | 6 +++--- Streaming.cpp | 2 +- TransitTunnel.cpp | 4 ++-- Transports.cpp | 4 ++-- Tunnel.cpp | 6 +++--- 16 files changed, 65 insertions(+), 61 deletions(-) diff --git a/AddressBook.cpp b/AddressBook.cpp index b993f456..67eb7566 100644 --- a/AddressBook.cpp +++ b/AddressBook.cpp @@ -599,7 +599,8 @@ namespace client } } - void AddressBook::HandleLookupResponse (const i2p::data::IdentityEx& from, uint16_t fromPort, uint16_t toPort, const uint8_t * buf, size_t len) + void AddressBook::HandleLookupResponse (const i2p::data::IdentityEx& from, uint16_t /*fromPort*/, + uint16_t /*toPort*/, const uint8_t * buf, size_t len) { if (len < 44) { diff --git a/BOB.cpp b/BOB.cpp index 8ffffba6..2d96f4b2 100644 --- a/BOB.cpp +++ b/BOB.cpp @@ -284,7 +284,7 @@ namespace client std::placeholders::_1, std::placeholders::_2)); } - void BOBCommandSession::HandleSent (const boost::system::error_code& ecode, std::size_t bytes_transferred) + void BOBCommandSession::HandleSent (const boost::system::error_code& ecode, std::size_t /*bytes_transferred*/) { if (ecode) { @@ -338,20 +338,20 @@ namespace client Send (len); } - void BOBCommandSession::ZapCommandHandler (const char * operand, size_t len) + void BOBCommandSession::ZapCommandHandler (const char * /*operand*/, size_t /*len*/) { LogPrint (eLogDebug, "BOB: zap"); Terminate (); } - void BOBCommandSession::QuitCommandHandler (const char * operand, size_t len) + void BOBCommandSession::QuitCommandHandler (const char * /*operand*/, size_t /*len*/) { LogPrint (eLogDebug, "BOB: quit"); m_IsOpen = false; SendReplyOK ("Bye!"); } - void BOBCommandSession::StartCommandHandler (const char * operand, size_t len) + void BOBCommandSession::StartCommandHandler (const char * /*operand*/, size_t /*len*/) { LogPrint (eLogDebug, "BOB: start ", m_Nickname); if (m_IsActive) @@ -373,7 +373,7 @@ namespace client m_IsActive = true; } - void BOBCommandSession::StopCommandHandler (const char * operand, size_t len) + void BOBCommandSession::StopCommandHandler (const char * /*operand*/, size_t /*len*/) { LogPrint (eLogDebug, "BOB: stop ", m_Nickname); if (!m_IsActive) @@ -392,7 +392,7 @@ namespace client m_IsActive = false; } - void BOBCommandSession::SetNickCommandHandler (const char * operand, size_t len) + void BOBCommandSession::SetNickCommandHandler (const char * operand, size_t /*len*/) { LogPrint (eLogDebug, "BOB: setnick ", operand); m_Nickname = operand; @@ -401,7 +401,7 @@ namespace client SendReplyOK (msg.c_str ()); } - void BOBCommandSession::GetNickCommandHandler (const char * operand, size_t len) + void BOBCommandSession::GetNickCommandHandler (const char * operand, size_t /*len*/) { LogPrint (eLogDebug, "BOB: getnick ", operand); m_CurrentDestination = m_Owner.FindDestination (operand); @@ -420,40 +420,40 @@ namespace client SendReplyError ("no nickname has been set"); } - void BOBCommandSession::NewkeysCommandHandler (const char * operand, size_t len) + void BOBCommandSession::NewkeysCommandHandler (const char* /*operand*/, size_t /*len*/) { LogPrint (eLogDebug, "BOB: newkeys"); m_Keys = i2p::data::PrivateKeys::CreateRandomKeys (); SendReplyOK (m_Keys.GetPublic ()->ToBase64 ().c_str ()); } - void BOBCommandSession::SetkeysCommandHandler (const char * operand, size_t len) + void BOBCommandSession::SetkeysCommandHandler (const char* operand, size_t /*len*/) { LogPrint (eLogDebug, "BOB: setkeys ", operand); m_Keys.FromBase64 (operand); SendReplyOK (m_Keys.GetPublic ()->ToBase64 ().c_str ()); } - void BOBCommandSession::GetkeysCommandHandler (const char * operand, size_t len) + void BOBCommandSession::GetkeysCommandHandler (const char* /*operand*/, size_t /*len*/) { LogPrint (eLogDebug, "BOB: getkeys"); SendReplyOK (m_Keys.ToBase64 ().c_str ()); } - void BOBCommandSession::GetdestCommandHandler (const char * operand, size_t len) + void BOBCommandSession::GetdestCommandHandler (const char* /*operand*/, size_t /*len*/) { LogPrint (eLogDebug, "BOB: getdest"); SendReplyOK (m_Keys.GetPublic ()->ToBase64 ().c_str ()); } - void BOBCommandSession::OuthostCommandHandler (const char * operand, size_t len) + void BOBCommandSession::OuthostCommandHandler (const char* operand, size_t /*len*/) { LogPrint (eLogDebug, "BOB: outhost ", operand); m_Address = operand; SendReplyOK ("outhost set"); } - void BOBCommandSession::OutportCommandHandler (const char * operand, size_t len) + void BOBCommandSession::OutportCommandHandler (const char* operand, size_t /*len*/) { LogPrint (eLogDebug, "BOB: outport ", operand); m_OutPort = boost::lexical_cast(operand); @@ -463,14 +463,14 @@ namespace client SendReplyError ("port out of range"); } - void BOBCommandSession::InhostCommandHandler (const char * operand, size_t len) + void BOBCommandSession::InhostCommandHandler (const char* operand, size_t /*len*/) { LogPrint (eLogDebug, "BOB: inhost ", operand); m_Address = operand; SendReplyOK ("inhost set"); } - void BOBCommandSession::InportCommandHandler (const char * operand, size_t len) + void BOBCommandSession::InportCommandHandler (const char* operand, size_t /*len*/) { LogPrint (eLogDebug, "BOB: inport ", operand); m_InPort = boost::lexical_cast(operand); @@ -480,7 +480,7 @@ namespace client SendReplyError ("port out of range"); } - void BOBCommandSession::QuietCommandHandler (const char * operand, size_t len) + void BOBCommandSession::QuietCommandHandler (const char* /*operand*/, size_t /*len*/) { LogPrint (eLogDebug, "BOB: quiet"); if (m_Nickname.length () > 0) @@ -497,7 +497,7 @@ namespace client SendReplyError ("no nickname has been set"); } - void BOBCommandSession::LookupCommandHandler (const char * operand, size_t len) + void BOBCommandSession::LookupCommandHandler (const char* operand, size_t /*len*/) { LogPrint (eLogDebug, "BOB: lookup ", operand); i2p::data::IdentHash ident; @@ -525,7 +525,7 @@ namespace client } } - void BOBCommandSession::ClearCommandHandler (const char * operand, size_t len) + void BOBCommandSession::ClearCommandHandler (const char* /*operand*/, size_t /*len*/) { LogPrint (eLogDebug, "BOB: clear"); m_Owner.DeleteDestination (m_Nickname); @@ -533,7 +533,7 @@ namespace client SendReplyOK ("cleared"); } - void BOBCommandSession::ListCommandHandler (const char * operand, size_t len) + void BOBCommandSession::ListCommandHandler (const char* /*operand*/, size_t /*len*/) { LogPrint (eLogDebug, "BOB: list"); const auto& destinations = m_Owner.GetDestinations (); @@ -542,7 +542,7 @@ namespace client SendReplyOK ("Listing done"); } - void BOBCommandSession::OptionCommandHandler (const char * operand, size_t len) + void BOBCommandSession::OptionCommandHandler (const char* operand, size_t /*len*/) { LogPrint (eLogDebug, "BOB: option ", operand); const char * value = strchr (operand, '='); @@ -561,7 +561,7 @@ namespace client SendReplyError ("malformed"); } - void BOBCommandSession::StatusCommandHandler (const char * operand, size_t len) + void BOBCommandSession::StatusCommandHandler (const char* operand, size_t /*len*/) { LogPrint (eLogDebug, "BOB: status ", operand); if (m_Nickname == operand) diff --git a/Destination.cpp b/Destination.cpp index 48717f5f..0aefa6ab 100644 --- a/Destination.cpp +++ b/Destination.cpp @@ -265,7 +265,7 @@ namespace client m_Service.post (std::bind (&LeaseSetDestination::HandleDeliveryStatusMessage, shared_from_this (), msg)); } - void LeaseSetDestination::HandleI2NPMessage (const uint8_t * buf, size_t len, std::shared_ptr from) + void LeaseSetDestination::HandleI2NPMessage (const uint8_t * buf, size_t /*len*/, std::shared_ptr from) { uint8_t typeID = buf[I2NP_HEADER_TYPEID_OFFSET]; switch (typeID) @@ -353,7 +353,7 @@ namespace client } } - void LeaseSetDestination::HandleDatabaseSearchReplyMessage (const uint8_t * buf, size_t len) + void LeaseSetDestination::HandleDatabaseSearchReplyMessage (const uint8_t * buf, size_t /*len*/) { i2p::data::IdentHash key (buf); int num = buf[32]; // num @@ -737,7 +737,7 @@ namespace client ScheduleCheckForReady(p); } - void ClientDestination::HandleDataMessage (const uint8_t * buf, size_t len) + void ClientDestination::HandleDataMessage (const uint8_t * buf, size_t /*len*/) { uint32_t length = bufbe32toh (buf); buf += 4; diff --git a/Family.cpp b/Family.cpp index c1840e51..b37af204 100644 --- a/Family.cpp +++ b/Family.cpp @@ -110,7 +110,7 @@ namespace data } bool Families::VerifyFamily (const std::string& family, const IdentHash& ident, - const char * signature, const char * key) + const char * signature, const char * /*key*/) { uint8_t buf[50], signatureBuf[64]; size_t len = family.length (), signatureLen = strlen (signature); diff --git a/I2CP.cpp b/I2CP.cpp index 41f81155..3c8ed9bb 100644 --- a/I2CP.cpp +++ b/I2CP.cpp @@ -186,7 +186,7 @@ namespace client std::bind (&I2CPSession::HandleReceivedHeader, shared_from_this (), std::placeholders::_1, std::placeholders::_2)); } - void I2CPSession::HandleReceivedHeader (const boost::system::error_code& ecode, std::size_t bytes_transferred) + void I2CPSession::HandleReceivedHeader (const boost::system::error_code& ecode, std::size_t /*bytes_transferred*/) { if (ecode) Terminate (); @@ -213,7 +213,7 @@ namespace client std::bind (&I2CPSession::HandleReceivedPayload, shared_from_this (), std::placeholders::_1, std::placeholders::_2)); } - void I2CPSession::HandleReceivedPayload (const boost::system::error_code& ecode, std::size_t bytes_transferred) + void I2CPSession::HandleReceivedPayload (const boost::system::error_code& ecode, std::size_t /*bytes_transferred*/) { if (ecode) Terminate (); @@ -270,7 +270,8 @@ namespace client LogPrint (eLogError, "I2CP: Can't write to the socket"); } - void I2CPSession::HandleI2CPMessageSent (const boost::system::error_code& ecode, std::size_t bytes_transferred, const uint8_t * buf) + void I2CPSession::HandleI2CPMessageSent (const boost::system::error_code& ecode, + std::size_t /*bytes_transferred*/, const uint8_t* buf) { delete[] buf; if (ecode && ecode != boost::asio::error::operation_aborted) @@ -385,7 +386,7 @@ namespace client } } - void I2CPSession::DestroySessionMessageHandler (const uint8_t * buf, size_t len) + void I2CPSession::DestroySessionMessageHandler (const uint8_t* /*buf*/, size_t /*len*/) { SendSessionStatusMessage (0); // destroy LogPrint (eLogDebug, "I2CP: session ", m_SessionID, " destroyed"); @@ -396,7 +397,7 @@ namespace client } } - void I2CPSession::ReconfigureSessionMessageHandler (const uint8_t * buf, size_t len) + void I2CPSession::ReconfigureSessionMessageHandler (const uint8_t* /*buf*/, size_t /*len*/) { // TODO: implement actual reconfiguration SendSessionStatusMessage (2); // updated @@ -558,7 +559,7 @@ namespace client } } - void I2CPSession::DestLookupMessageHandler (const uint8_t * buf, size_t len) + void I2CPSession::DestLookupMessageHandler (const uint8_t * buf, size_t /*len*/) { if (m_Destination) { @@ -595,7 +596,7 @@ namespace client SendI2CPMessage (I2CP_DEST_REPLY_MESSAGE, buf, 32); } - void I2CPSession::GetBandwidthLimitsMessageHandler (const uint8_t * buf, size_t len) + void I2CPSession::GetBandwidthLimitsMessageHandler (const uint8_t* /*buf*/, size_t /*len*/) { uint8_t limits[64]; memset (limits, 0, 64); diff --git a/I2PControl.cpp b/I2PControl.cpp index 3e2e3997..7f063f35 100644 --- a/I2PControl.cpp +++ b/I2PControl.cpp @@ -295,8 +295,8 @@ namespace client std::placeholders::_1, std::placeholders::_2, socket, buf)); } - void I2PControlService::HandleResponseSent (const boost::system::error_code& ecode, std::size_t bytes_transferred, - std::shared_ptr socket, std::shared_ptr buf) + void I2PControlService::HandleResponseSent (const boost::system::error_code& ecode, std::size_t /*bytes_transferred*/, + std::shared_ptr /*socket*/, std::shared_ptr /*buf*/) { if (ecode) { LogPrint (eLogError, "I2PControl: write error: ", ecode.message ()); @@ -453,7 +453,7 @@ namespace client InsertParam (results, "Shutdown", ""); m_ShutdownTimer.expires_from_now (boost::posix_time::seconds(1)); // 1 second to make sure response has been sent m_ShutdownTimer.async_wait ( - [](const boost::system::error_code& ecode) + [](const boost::system::error_code&) { Daemon.running = 0; }); @@ -467,7 +467,7 @@ namespace client InsertParam (results, "ShutdownGraceful", ""); m_ShutdownTimer.expires_from_now (boost::posix_time::seconds(timeout + 1)); // + 1 second m_ShutdownTimer.async_wait ( - [](const boost::system::error_code& ecode) + [](const boost::system::error_code&) { Daemon.running = 0; }); diff --git a/I2PTunnel.cpp b/I2PTunnel.cpp index 0c58ba9d..a9c5c313 100644 --- a/I2PTunnel.cpp +++ b/I2PTunnel.cpp @@ -439,7 +439,7 @@ namespace client } void I2PServerTunnel::HandleResolve (const boost::system::error_code& ecode, boost::asio::ip::tcp::resolver::iterator it, - std::shared_ptr resolver) + std::shared_ptr /*resolver*/) { if (!ecode) { @@ -730,7 +730,8 @@ namespace client m_Session = new UDPSession(m_LocalEndpoint, m_LocalDest, ep, *m_RemoteIdent, LocalPort, RemotePort); } - void I2PUDPClientTunnel::HandleRecvFromI2P(const i2p::data::IdentityEx& from, uint16_t fromPort, uint16_t toPort, const uint8_t * buf, size_t len) + void I2PUDPClientTunnel::HandleRecvFromI2P(const i2p::data::IdentityEx& from, uint16_t /*fromPort*/, + uint16_t /*toPort*/, const uint8_t * buf, size_t len) { if(m_RemoteIdent && from.GetIdentHash() == *m_RemoteIdent) { diff --git a/LeaseSet.cpp b/LeaseSet.cpp index 04dc77c5..4ddd07f3 100644 --- a/LeaseSet.cpp +++ b/LeaseSet.cpp @@ -173,7 +173,7 @@ namespace data const std::vector > LeaseSet::GetNonExpiredLeases (bool withThreshold) const { - return GetNonExpiredLeasesExcluding( [] (const Lease & l) -> bool { return false; }, withThreshold); + return GetNonExpiredLeasesExcluding( [] (const Lease &) -> bool { return false; }, withThreshold); } const std::vector > LeaseSet::GetNonExpiredLeasesExcluding (LeaseInspectFunc exclude, bool withThreshold) const diff --git a/RouterContext.cpp b/RouterContext.cpp index 6824adb8..15084bd3 100644 --- a/RouterContext.cpp +++ b/RouterContext.cpp @@ -424,7 +424,7 @@ namespace i2p return i2p::tunnel::tunnels.GetExploratoryPool (); } - void RouterContext::HandleI2NPMessage (const uint8_t * buf, size_t len, std::shared_ptr from) + void RouterContext::HandleI2NPMessage (const uint8_t * buf, size_t /*len*/, std::shared_ptr from) { i2p::HandleI2NPMessage (CreateI2NPMessage (buf, GetI2NPMessageLength (buf), from)); } diff --git a/SAM.cpp b/SAM.cpp index 2864cd6f..ce85fc8d 100644 --- a/SAM.cpp +++ b/SAM.cpp @@ -135,7 +135,7 @@ namespace client } } - void SAMSocket::HandleHandshakeReplySent (const boost::system::error_code& ecode, std::size_t bytes_transferred) + void SAMSocket::HandleHandshakeReplySent (const boost::system::error_code& ecode, std::size_t /*bytes_transferred*/) { if (ecode) { @@ -166,7 +166,7 @@ namespace client } } - void SAMSocket::HandleMessageReplySent (const boost::system::error_code& ecode, std::size_t bytes_transferred, bool close) + void SAMSocket::HandleMessageReplySent (const boost::system::error_code& ecode, std::size_t /*bytes_transferred*/, bool close) { if (ecode) { @@ -262,7 +262,7 @@ namespace client } } - void SAMSocket::ProcessSessionCreate (char * buf, size_t len) + void SAMSocket::ProcessSessionCreate (char * buf, size_t /*len*/) { LogPrint (eLogDebug, "SAM: session create: ", buf); std::map params; @@ -333,7 +333,7 @@ namespace client SendMessageReply (m_Buffer, l2, false); } - void SAMSocket::ProcessStreamConnect (char * buf, size_t len) + void SAMSocket::ProcessStreamConnect (char * buf, size_t /*len*/) { LogPrint (eLogDebug, "SAM: stream connect: ", buf); std::map params; @@ -389,7 +389,7 @@ namespace client } } - void SAMSocket::ProcessStreamAccept (char * buf, size_t len) + void SAMSocket::ProcessStreamAccept (char * buf, size_t /*len*/) { LogPrint (eLogDebug, "SAM: stream accept: ", buf); std::map params; @@ -460,7 +460,7 @@ namespace client SendMessageReply (m_Buffer, len, false); } - void SAMSocket::ProcessNamingLookup (char * buf, size_t len) + void SAMSocket::ProcessNamingLookup (char * buf, size_t /*len*/) { LogPrint (eLogDebug, "SAM: naming lookup: ", buf); std::map params; @@ -652,7 +652,8 @@ namespace client LogPrint (eLogWarning, "SAM: I2P acceptor has been reset"); } - void SAMSocket::HandleI2PDatagramReceive (const i2p::data::IdentityEx& from, uint16_t fromPort, uint16_t toPort, const uint8_t * buf, size_t len) + void SAMSocket::HandleI2PDatagramReceive (const i2p::data::IdentityEx& from, uint16_t /*fromPort*/, + uint16_t /*toPort*/, const uint8_t* buf, size_t len) { LogPrint (eLogDebug, "SAM: datagram received ", len); auto base64 = from.ToBase64 (); diff --git a/SOCKS.cpp b/SOCKS.cpp index 9d85963b..a52fe612 100644 --- a/SOCKS.cpp +++ b/SOCKS.cpp @@ -696,7 +696,7 @@ namespace proxy } - void SOCKSHandler::HandleUpstreamData(uint8_t * dataptr, std::size_t len) + void SOCKSHandler::HandleUpstreamData(uint8_t* /*dataptr*/, std::size_t len) { if (m_state == UPSTREAM_HANDSHAKE) { m_upstream_response_len += len; @@ -739,7 +739,7 @@ namespace proxy } } - void SOCKSHandler::HandleUpstreamConnected(const boost::system::error_code & ecode, boost::asio::ip::tcp::resolver::iterator itr) + void SOCKSHandler::HandleUpstreamConnected(const boost::system::error_code & ecode, boost::asio::ip::tcp::resolver::iterator) { if (ecode) { LogPrint(eLogWarning, "SOCKS: could not connect to upstream proxy: ", ecode.message()); diff --git a/SSUSession.cpp b/SSUSession.cpp index 5cd59164..fbb5b11d 100644 --- a/SSUSession.cpp +++ b/SSUSession.cpp @@ -536,7 +536,7 @@ namespace transport Send (buf, msgLen); } - void SSUSession::ProcessRelayRequest (const uint8_t * buf, size_t len, const boost::asio::ip::udp::endpoint& from) + void SSUSession::ProcessRelayRequest (const uint8_t * buf, size_t /*len*/, const boost::asio::ip::udp::endpoint& from) { uint32_t relayTag = bufbe32toh (buf); auto session = m_Server.FindRelaySession (relayTag); @@ -637,7 +637,7 @@ namespace transport LogPrint (eLogDebug, "SSU: relay intro sent"); } - void SSUSession::ProcessRelayResponse (const uint8_t * buf, size_t len) + void SSUSession::ProcessRelayResponse (const uint8_t * buf, size_t /*len*/) { LogPrint (eLogDebug, "SSU message: Relay response received"); uint8_t remoteSize = *buf; @@ -689,7 +689,7 @@ namespace transport LogPrint (eLogError, "SSU: Unsolicited RelayResponse, nonce=", nonce); } - void SSUSession::ProcessRelayIntro (const uint8_t * buf, size_t len) + void SSUSession::ProcessRelayIntro (const uint8_t * buf, size_t /*len*/) { uint8_t size = *buf; if (size == 4) diff --git a/Streaming.cpp b/Streaming.cpp index 02e738c8..e8f5a897 100644 --- a/Streaming.cpp +++ b/Streaming.cpp @@ -729,7 +729,7 @@ namespace stream } } - void Stream::HandleAckSendTimer (const boost::system::error_code& ecode) + void Stream::HandleAckSendTimer (const boost::system::error_code&) { if (m_IsAckSendScheduled) { diff --git a/TransitTunnel.cpp b/TransitTunnel.cpp index dfe01a05..d06f5134 100644 --- a/TransitTunnel.cpp +++ b/TransitTunnel.cpp @@ -51,12 +51,12 @@ namespace tunnel } } - void TransitTunnel::SendTunnelDataMsg (std::shared_ptr msg) + void TransitTunnel::SendTunnelDataMsg (std::shared_ptr /*msg*/) { LogPrint (eLogError, "TransitTunnel: We are not a gateway for ", GetTunnelID ()); } - void TransitTunnel::HandleTunnelDataMsg (std::shared_ptr tunnelMsg) + void TransitTunnel::HandleTunnelDataMsg (std::shared_ptr /*msg*/) { LogPrint (eLogError, "TransitTunnel: Incoming tunnel message is not supported ", GetTunnelID ()); } diff --git a/Transports.cpp b/Transports.cpp index a29cac15..e0d2df7a 100644 --- a/Transports.cpp +++ b/Transports.cpp @@ -394,7 +394,7 @@ namespace transport } void Transports::HandleNTCPResolve (const boost::system::error_code& ecode, boost::asio::ip::tcp::resolver::iterator it, - i2p::data::IdentHash ident, std::shared_ptr resolver) + i2p::data::IdentHash ident, std::shared_ptr /*resolver*/) { auto it1 = m_Peers.find (ident); if (it1 != m_Peers.end ()) @@ -437,7 +437,7 @@ namespace transport } void Transports::HandleSSUResolve (const boost::system::error_code& ecode, boost::asio::ip::tcp::resolver::iterator it, - i2p::data::IdentHash ident, std::shared_ptr resolver) + i2p::data::IdentHash ident, std::shared_ptr /*resolver*/) { auto it1 = m_Peers.find (ident); if (it1 != m_Peers.end ()) diff --git a/Tunnel.cpp b/Tunnel.cpp index 7d2e6735..3749c9ca 100644 --- a/Tunnel.cpp +++ b/Tunnel.cpp @@ -90,7 +90,7 @@ namespace tunnel i2p::transport::transports.SendMessage (GetNextIdentHash (), msg); } - bool Tunnel::HandleTunnelBuildResponse (uint8_t * msg, size_t len) + bool Tunnel::HandleTunnelBuildResponse (uint8_t * msg, size_t /*len*/) { LogPrint (eLogDebug, "Tunnel: TunnelBuildResponse ", (int)msg[0], " records."); @@ -161,7 +161,7 @@ namespace tunnel } } - void Tunnel::SendTunnelDataMsg (std::shared_ptr msg) + void Tunnel::SendTunnelDataMsg (std::shared_ptr /*msg*/) { LogPrint (eLogWarning, "Tunnel: Can't send I2NP messages without delivery instructions"); } @@ -256,7 +256,7 @@ namespace tunnel m_Gateway.SendBuffer (); } - void OutboundTunnel::HandleTunnelDataMsg (std::shared_ptr tunnelMsg) + void OutboundTunnel::HandleTunnelDataMsg (std::shared_ptr /*msg*/) { LogPrint (eLogError, "Tunnel: incoming message for outbound tunnel ", GetTunnelID ()); } From 012ade500061da29693340a48cdd6b8e67d02293 Mon Sep 17 00:00:00 2001 From: Pavel Melkozerov Date: Tue, 4 Oct 2016 18:13:45 +0300 Subject: [PATCH 07/24] Added extra-cmake-modules --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index bb81757b..be16e890 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -142,9 +142,9 @@ install: - if not defined msvc ( C:\msys64\usr\bin\bash -lc "pacman --needed --noconfirm -Sy bash pacman pacman-mirrors msys2-runtime msys2-runtime-devel cmake" && if "%x64%" == "1" ( - C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-x86_64-openssl mingw-w64-x86_64-boost mingw-w64-x86_64-miniupnpc" + C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-x86_64-openssl mingw-w64-x86_64-boost mingw-w64-x86_64-miniupnpc mingw-w64-x86_64-extra-cmake-modules" ) else ( - C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-i686-openssl mingw-w64-i686-boost mingw-w64-i686-miniupnpc" + C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-i686-openssl mingw-w64-i686-boost mingw-w64-i686-miniupnpc mingw-w64-i686-extra-cmake-modules" ) ) cache: From e8e3db688803309c7411b29f7b6ca0c159872f98 Mon Sep 17 00:00:00 2001 From: alexandr Date: Wed, 5 Oct 2016 01:20:43 +0500 Subject: [PATCH 08/24] fix f79ad91 --- Destination.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Destination.cpp b/Destination.cpp index dbdec0c7..0b8f2859 100644 --- a/Destination.cpp +++ b/Destination.cpp @@ -185,6 +185,7 @@ namespace client if(ls && !ls->IsExpired()) { ls->PopulateLeases(); + std::unique_lock lock(m_RemoteLeaseSetsMutex); m_RemoteLeaseSets[ident] = ls; } }); From cb0f9684673432dfe391985c82ca5b1b948c0277 Mon Sep 17 00:00:00 2001 From: alexandr Date: Wed, 5 Oct 2016 06:45:41 +0500 Subject: [PATCH 09/24] Added building option "USE_ASLR" --- Makefile.mingw | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile.mingw b/Makefile.mingw index 85b6b455..5a8e8fc0 100644 --- a/Makefile.mingw +++ b/Makefile.mingw @@ -37,11 +37,16 @@ ifeq ($(USE_WIN32_APP), yes) DAEMON_OBJS += $(patsubst %.rc,obj/%.o,$(DAEMON_RC)) endif -ifeq ($(USE_AESNI),1) +ifeq ($(USE_AESNI),yes) CPU_FLAGS = -maes -DAESNI else CPU_FLAGS = -msse endif +ifeq ($(USE_ASLR),yes) + LDFLAGS += -Wl,--nxcompat -Wl,--high-entropy-va \ + -Wl,--dynamicbase,--export-all-symbols +endif + obj/%.o : %.rc $(WINDRES) -i $< -o $@ From ae2b5dfd3ef4f6b343e2d4f81162444164049a64 Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Tue, 4 Oct 2016 17:50:18 -0400 Subject: [PATCH 10/24] fix udp tunnel route switching logic --- Datagram.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Datagram.cpp b/Datagram.cpp index b9188864..92c2509c 100644 --- a/Datagram.cpp +++ b/Datagram.cpp @@ -276,7 +276,7 @@ namespace datagram // our path looks dead so we need to rotate paths if (now - m_LastSuccess >= DATAGRAM_SESSION_PATH_TIMEOUT) return true; // if we have a routing session and routing path we don't need to switch paths - return m_RoutingSession != nullptr && m_RoutingSession->GetSharedRoutingPath () != nullptr; + return m_RoutingSession == nullptr || m_RoutingSession->GetSharedRoutingPath () == nullptr; } @@ -291,7 +291,7 @@ namespace datagram if(currentLease) // if we have a lease return true if it's about to expire otherwise return false return currentLease->ExpiresWithin( DATAGRAM_SESSION_LEASE_HANDOVER_WINDOW, DATAGRAM_SESSION_LEASE_HANDOVER_FUDGE ); // we have no current lease, we should switch - return true; + return currentLease == nullptr; } std::shared_ptr DatagramSession::GetNextRoutingPath() From 30dfe129106dd2bb5240d3d877c03f378bc10b20 Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Wed, 5 Oct 2016 10:45:41 -0400 Subject: [PATCH 11/24] try fixing appveyor --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index bb81757b..ddacb73b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -22,7 +22,7 @@ init: if exist \OpenSSL rmdir /S /Q \OpenSSL environment: - BOOST_ROOT: C:\Libraries\boost_1_59_0 + BOOST_ROOT: C:\Libraries\boost_1_60_0 MINIUPNPC: miniupnpc-1.9.20151026 OPENSSL: OpenSSL_1_0_2e ZLIB: zlib-1.2.8 @@ -167,7 +167,7 @@ build_script: echo "bitness=%bitness%; static=%static%; dll=%dll%; type=%type%; generator=%generator%; variant=%variant%; cmake=%cmake%; cmake_extra=%cmake_extra%" - if not defined msvc ( - C:\msys64\usr\bin\bash -lc "export PATH=/mingw%bitness%/bin:/usr/bin && cd /c/projects/build && CC=/mingw%bitness%/bin/gcc.exe CXX=/mingw%bitness%/bin/g++.exe /usr/bin/cmake /c/projects/i2pd/build -G 'Unix Makefiles' -DWITH_AESNI=ON -DWITH_UPNP=ON %cmake% %cmake_extra% -DWITH_STATIC=%static% -DWITH_HARDENING=ON -DCMAKE_INSTALL_PREFIX:PATH=/c/projects/instdir -DCMAKE_FIND_ROOT_PATH=/mingw%bitness% && make install" + C:\msys64\usr\bin\bash -lc "export PATH=/mingw%bitness%/bin:/usr/bin && cd /c/projects/build && CC=/mingw%bitness%/bin/gcc.exe CXX=/mingw%bitness%/bin/g++.exe /usr/bin/cmake /c/projects/i2pd/build -G 'Unix Makefiles' -DBOOSTROOT=/mingw%bitness%/ -DWITH_AESNI=ON -DWITH_UPNP=ON %cmake% %cmake_extra% -DWITH_STATIC=%static% -DWITH_HARDENING=ON -DCMAKE_INSTALL_PREFIX:PATH=/c/projects/instdir -DCMAKE_FIND_ROOT_PATH=/mingw%bitness% && make install" && 7z a -tzip -mx9 -mmt C:\projects\i2pd\i2pd-mingw-win%bitness%-%type%.zip C:\projects\instdir\* C:\msys64\mingw%bitness%\bin\zlib1.dll C:\msys64\mingw%bitness%\bin\*eay32.dll ) - rem We are fine with multiple generated configurations in MS solution. Will use later From 4a3bf46c30878bf5d3bcacd3eda11b285b219c19 Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Wed, 5 Oct 2016 11:03:51 -0400 Subject: [PATCH 12/24] Revert "try fixing appveyor" This reverts commit 30dfe129106dd2bb5240d3d877c03f378bc10b20. --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index ddacb73b..bb81757b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -22,7 +22,7 @@ init: if exist \OpenSSL rmdir /S /Q \OpenSSL environment: - BOOST_ROOT: C:\Libraries\boost_1_60_0 + BOOST_ROOT: C:\Libraries\boost_1_59_0 MINIUPNPC: miniupnpc-1.9.20151026 OPENSSL: OpenSSL_1_0_2e ZLIB: zlib-1.2.8 @@ -167,7 +167,7 @@ build_script: echo "bitness=%bitness%; static=%static%; dll=%dll%; type=%type%; generator=%generator%; variant=%variant%; cmake=%cmake%; cmake_extra=%cmake_extra%" - if not defined msvc ( - C:\msys64\usr\bin\bash -lc "export PATH=/mingw%bitness%/bin:/usr/bin && cd /c/projects/build && CC=/mingw%bitness%/bin/gcc.exe CXX=/mingw%bitness%/bin/g++.exe /usr/bin/cmake /c/projects/i2pd/build -G 'Unix Makefiles' -DBOOSTROOT=/mingw%bitness%/ -DWITH_AESNI=ON -DWITH_UPNP=ON %cmake% %cmake_extra% -DWITH_STATIC=%static% -DWITH_HARDENING=ON -DCMAKE_INSTALL_PREFIX:PATH=/c/projects/instdir -DCMAKE_FIND_ROOT_PATH=/mingw%bitness% && make install" + C:\msys64\usr\bin\bash -lc "export PATH=/mingw%bitness%/bin:/usr/bin && cd /c/projects/build && CC=/mingw%bitness%/bin/gcc.exe CXX=/mingw%bitness%/bin/g++.exe /usr/bin/cmake /c/projects/i2pd/build -G 'Unix Makefiles' -DWITH_AESNI=ON -DWITH_UPNP=ON %cmake% %cmake_extra% -DWITH_STATIC=%static% -DWITH_HARDENING=ON -DCMAKE_INSTALL_PREFIX:PATH=/c/projects/instdir -DCMAKE_FIND_ROOT_PATH=/mingw%bitness% && make install" && 7z a -tzip -mx9 -mmt C:\projects\i2pd\i2pd-mingw-win%bitness%-%type%.zip C:\projects\instdir\* C:\msys64\mingw%bitness%\bin\zlib1.dll C:\msys64\mingw%bitness%\bin\*eay32.dll ) - rem We are fine with multiple generated configurations in MS solution. Will use later From 71d4221af2604850363ed890949fe5227af85cd3 Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Wed, 5 Oct 2016 10:06:06 -0400 Subject: [PATCH 13/24] add keyinfo tool --- .gitignore | 10 ++++- Makefile | 8 +++- contrib/tools/Makefile | 7 ++++ contrib/tools/README.md | 6 +++ contrib/tools/keyinfo/Makefile | 8 ++++ contrib/tools/keyinfo/README.md | 5 +++ contrib/tools/keyinfo/keyinfo.cpp | 70 +++++++++++++++++++++++++++++++ 7 files changed, 112 insertions(+), 2 deletions(-) create mode 100644 contrib/tools/Makefile create mode 100644 contrib/tools/README.md create mode 100644 contrib/tools/keyinfo/Makefile create mode 100644 contrib/tools/keyinfo/README.md create mode 100644 contrib/tools/keyinfo/keyinfo.cpp diff --git a/.gitignore b/.gitignore index b6cffd15..73297488 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,7 @@ netDb autom4te.cache .deps stamp-h1 -Makefile +#Makefile config.h config.h.in~ config.log @@ -238,3 +238,11 @@ pip-log.txt # Sphinx docs/_build /androidIdea/ + + +# emacs files +*~ +*\#* + +# gdb files +.gdb_history \ No newline at end of file diff --git a/Makefile b/Makefile index 147bedd4..c68b977e 100644 --- a/Makefile +++ b/Makefile @@ -80,7 +80,13 @@ $(ARLIB): $(patsubst %.cpp,obj/%.o,$(LIB_SRC)) $(ARLIB_CLIENT): $(patsubst %.cpp,obj/%.o,$(LIB_CLIENT_SRC)) ar -r $@ $^ -clean: +tools: $(ARLIB) + $(MAKE) -C contrib/tools/ + +clean-tools: + $(MAKE) -C contrib/tools/ clean + +clean: clean-tools rm -rf obj rm -rf docs/generated $(RM) $(I2PD) $(SHLIB) $(ARLIB) $(SHLIB_CLIENT) $(ARLIB_CLIENT) diff --git a/contrib/tools/Makefile b/contrib/tools/Makefile new file mode 100644 index 00000000..6c60bb59 --- /dev/null +++ b/contrib/tools/Makefile @@ -0,0 +1,7 @@ + + +all: + $(MAKE) -C keyinfo keyinfo + +clean: + $(MAKE) -C keyinfo clean diff --git a/contrib/tools/README.md b/contrib/tools/README.md new file mode 100644 index 00000000..e598adfa --- /dev/null +++ b/contrib/tools/README.md @@ -0,0 +1,6 @@ +Collection of i2pd related tools + +# Buildling + + +run `make tools` in the root of the repo diff --git a/contrib/tools/keyinfo/Makefile b/contrib/tools/keyinfo/Makefile new file mode 100644 index 00000000..44a13ff7 --- /dev/null +++ b/contrib/tools/keyinfo/Makefile @@ -0,0 +1,8 @@ +CXXFLAGS = -I ../../../ +all: keyinfo + +keyinfo: + $(CXX) -o keyinfo keyinfo.cpp $(CXXFLAGS) -std=c++11 ../../../libi2pd.a -lssl -lcrypto -lboost_system + +clean: + $(RM) keyinfo diff --git a/contrib/tools/keyinfo/README.md b/contrib/tools/keyinfo/README.md new file mode 100644 index 00000000..b3c39a4b --- /dev/null +++ b/contrib/tools/keyinfo/README.md @@ -0,0 +1,5 @@ +# keyinfo + +print information about a private key file + + diff --git a/contrib/tools/keyinfo/keyinfo.cpp b/contrib/tools/keyinfo/keyinfo.cpp new file mode 100644 index 00000000..6b6689c6 --- /dev/null +++ b/contrib/tools/keyinfo/keyinfo.cpp @@ -0,0 +1,70 @@ +#include "Identity.h" +#include +#include +#include +#include +#include + +int main(int argc, char * argv[]) +{ + if(argc == 1) { + std::cout << "usage: " << argv[0] << " [-v] [-d] privatekey.dat" << std::endl; + return -1; + } + int opt; + bool print_full = false; + bool verbose = false; + while((opt = getopt(argc, argv, "vd"))!=-1) { + switch(opt){ + case 'v': + verbose = true; + break; + case 'd': + print_full = true; + break; + default: + std::cout << "usage: " << argv[0] << " [-v] [-d] privatekey.dat" << std::endl; + return -1; + } + } + std::string fname(argv[optind]); + i2p::data::PrivateKeys keys; + { + std::vector buff; + std::ifstream inf; + inf.open(fname); + if (!inf.is_open()) { + std::cout << "cannot open private key file " << fname << std::endl; + return 2; + } + inf.seekg(0, std::ios::end); + const std::size_t len = inf.tellg(); + inf.seekg(0, std::ios::beg); + buff.resize(len); + inf.read((char*)buff.data(), buff.size()); + if (!keys.FromBuffer(buff.data(), buff.size())) { + std::cout << "bad key file format" << std::endl; + return 3; + } + } + auto dest = keys.GetPublic(); + if(!dest) { + std::cout << "failed to extract public key" << std::endl; + return 3; + } + + const auto & ident = dest->GetIdentHash(); + if (verbose) { + std::cout << "Destination: " << dest->ToBase64() << std::endl; + std::cout << "Destination Hash: " << ident.ToBase64() << std::endl; + std::cout << "B32 Address: " << ident.ToBase32() << ".b32.i2p" << std::endl; + std::cout << "Signature Type: " << (int) dest->GetSigningKeyType() << std::endl; + std::cout << "Encryption Type: " << (int) dest->GetCryptoKeyType() << std::endl; + } else { + if(print_full) { + std::cout << dest->ToBase64() << std::endl; + } else { + std::cout << ident.ToBase32() << ".b32.i2p" << std::endl; + } + } +} From 0fc4e01b1eca3c4c0719487c5c0ef4acb4fd1141 Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Mon, 10 Oct 2016 08:18:54 -0400 Subject: [PATCH 14/24] remove tools --- Makefile | 8 +--- contrib/tools/Makefile | 7 ---- contrib/tools/README.md | 6 --- contrib/tools/keyinfo/Makefile | 8 ---- contrib/tools/keyinfo/README.md | 5 --- contrib/tools/keyinfo/keyinfo.cpp | 70 ------------------------------- 6 files changed, 1 insertion(+), 103 deletions(-) delete mode 100644 contrib/tools/Makefile delete mode 100644 contrib/tools/README.md delete mode 100644 contrib/tools/keyinfo/Makefile delete mode 100644 contrib/tools/keyinfo/README.md delete mode 100644 contrib/tools/keyinfo/keyinfo.cpp diff --git a/Makefile b/Makefile index c68b977e..147bedd4 100644 --- a/Makefile +++ b/Makefile @@ -80,13 +80,7 @@ $(ARLIB): $(patsubst %.cpp,obj/%.o,$(LIB_SRC)) $(ARLIB_CLIENT): $(patsubst %.cpp,obj/%.o,$(LIB_CLIENT_SRC)) ar -r $@ $^ -tools: $(ARLIB) - $(MAKE) -C contrib/tools/ - -clean-tools: - $(MAKE) -C contrib/tools/ clean - -clean: clean-tools +clean: rm -rf obj rm -rf docs/generated $(RM) $(I2PD) $(SHLIB) $(ARLIB) $(SHLIB_CLIENT) $(ARLIB_CLIENT) diff --git a/contrib/tools/Makefile b/contrib/tools/Makefile deleted file mode 100644 index 6c60bb59..00000000 --- a/contrib/tools/Makefile +++ /dev/null @@ -1,7 +0,0 @@ - - -all: - $(MAKE) -C keyinfo keyinfo - -clean: - $(MAKE) -C keyinfo clean diff --git a/contrib/tools/README.md b/contrib/tools/README.md deleted file mode 100644 index e598adfa..00000000 --- a/contrib/tools/README.md +++ /dev/null @@ -1,6 +0,0 @@ -Collection of i2pd related tools - -# Buildling - - -run `make tools` in the root of the repo diff --git a/contrib/tools/keyinfo/Makefile b/contrib/tools/keyinfo/Makefile deleted file mode 100644 index 44a13ff7..00000000 --- a/contrib/tools/keyinfo/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -CXXFLAGS = -I ../../../ -all: keyinfo - -keyinfo: - $(CXX) -o keyinfo keyinfo.cpp $(CXXFLAGS) -std=c++11 ../../../libi2pd.a -lssl -lcrypto -lboost_system - -clean: - $(RM) keyinfo diff --git a/contrib/tools/keyinfo/README.md b/contrib/tools/keyinfo/README.md deleted file mode 100644 index b3c39a4b..00000000 --- a/contrib/tools/keyinfo/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# keyinfo - -print information about a private key file - - diff --git a/contrib/tools/keyinfo/keyinfo.cpp b/contrib/tools/keyinfo/keyinfo.cpp deleted file mode 100644 index 6b6689c6..00000000 --- a/contrib/tools/keyinfo/keyinfo.cpp +++ /dev/null @@ -1,70 +0,0 @@ -#include "Identity.h" -#include -#include -#include -#include -#include - -int main(int argc, char * argv[]) -{ - if(argc == 1) { - std::cout << "usage: " << argv[0] << " [-v] [-d] privatekey.dat" << std::endl; - return -1; - } - int opt; - bool print_full = false; - bool verbose = false; - while((opt = getopt(argc, argv, "vd"))!=-1) { - switch(opt){ - case 'v': - verbose = true; - break; - case 'd': - print_full = true; - break; - default: - std::cout << "usage: " << argv[0] << " [-v] [-d] privatekey.dat" << std::endl; - return -1; - } - } - std::string fname(argv[optind]); - i2p::data::PrivateKeys keys; - { - std::vector buff; - std::ifstream inf; - inf.open(fname); - if (!inf.is_open()) { - std::cout << "cannot open private key file " << fname << std::endl; - return 2; - } - inf.seekg(0, std::ios::end); - const std::size_t len = inf.tellg(); - inf.seekg(0, std::ios::beg); - buff.resize(len); - inf.read((char*)buff.data(), buff.size()); - if (!keys.FromBuffer(buff.data(), buff.size())) { - std::cout << "bad key file format" << std::endl; - return 3; - } - } - auto dest = keys.GetPublic(); - if(!dest) { - std::cout << "failed to extract public key" << std::endl; - return 3; - } - - const auto & ident = dest->GetIdentHash(); - if (verbose) { - std::cout << "Destination: " << dest->ToBase64() << std::endl; - std::cout << "Destination Hash: " << ident.ToBase64() << std::endl; - std::cout << "B32 Address: " << ident.ToBase32() << ".b32.i2p" << std::endl; - std::cout << "Signature Type: " << (int) dest->GetSigningKeyType() << std::endl; - std::cout << "Encryption Type: " << (int) dest->GetCryptoKeyType() << std::endl; - } else { - if(print_full) { - std::cout << dest->ToBase64() << std::endl; - } else { - std::cout << ident.ToBase32() << ".b32.i2p" << std::endl; - } - } -} From 8ba142eb4573d44b549bb220caae3313a9145f8d Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Thu, 6 Oct 2016 10:28:56 -0400 Subject: [PATCH 15/24] increase datagram session switching interval --- Datagram.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Datagram.h b/Datagram.h index f3aae6f9..c4ab8cd2 100644 --- a/Datagram.h +++ b/Datagram.h @@ -24,7 +24,7 @@ namespace datagram // milliseconds for how long we try sticking to a dead routing path before trying to switch const uint64_t DATAGRAM_SESSION_PATH_TIMEOUT = 5000; // milliseconds interval a routing path is used before switching - const uint64_t DATAGRAM_SESSION_PATH_SWITCH_INTERVAL = 60 * 1000; + const uint64_t DATAGRAM_SESSION_PATH_SWITCH_INTERVAL = 5 * 60 * 1000; // milliseconds before lease expire should we try switching leases const uint64_t DATAGRAM_SESSION_LEASE_HANDOVER_WINDOW = 10 * 1000; // milliseconds fudge factor for leases handover From 43c3bdf7c55141ecc6747b9c6cde7d45ed413bc0 Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Thu, 6 Oct 2016 13:41:18 -0400 Subject: [PATCH 16/24] fix --- Datagram.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Datagram.h b/Datagram.h index c4ab8cd2..f5397e56 100644 --- a/Datagram.h +++ b/Datagram.h @@ -24,7 +24,7 @@ namespace datagram // milliseconds for how long we try sticking to a dead routing path before trying to switch const uint64_t DATAGRAM_SESSION_PATH_TIMEOUT = 5000; // milliseconds interval a routing path is used before switching - const uint64_t DATAGRAM_SESSION_PATH_SWITCH_INTERVAL = 5 * 60 * 1000; + const uint64_t DATAGRAM_SESSION_PATH_SWITCH_INTERVAL = 20 * 60 * 1000; // milliseconds before lease expire should we try switching leases const uint64_t DATAGRAM_SESSION_LEASE_HANDOVER_WINDOW = 10 * 1000; // milliseconds fudge factor for leases handover From 577d9ddf6571fb05aecc7b391363ba0040bb1a4c Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Sun, 9 Oct 2016 10:55:55 -0400 Subject: [PATCH 17/24] fix memory leak with udp tunnel --- Datagram.cpp | 31 ++++++++++++++++++------------- Datagram.h | 3 ++- I2PTunnel.cpp | 16 +++++----------- I2PTunnel.h | 2 +- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Datagram.cpp b/Datagram.cpp index 92c2509c..0fce1166 100644 --- a/Datagram.cpp +++ b/Datagram.cpp @@ -12,8 +12,10 @@ namespace i2p namespace datagram { DatagramDestination::DatagramDestination (std::shared_ptr owner): - m_Owner (owner.get()), m_Receiver (nullptr) + m_Owner (owner.get()), + m_Receiver (nullptr) { + m_Identity.FromBase64 (owner->GetIdentity()->ToBase64()); } DatagramDestination::~DatagramDestination () @@ -24,16 +26,16 @@ namespace datagram void DatagramDestination::SendDatagramTo (const uint8_t * payload, size_t len, const i2p::data::IdentHash& ident, uint16_t fromPort, uint16_t toPort) { auto owner = m_Owner; - auto i = owner->GetIdentity(); - uint8_t buf[MAX_DATAGRAM_SIZE]; - auto identityLen = i->ToBuffer (buf, MAX_DATAGRAM_SIZE); + std::vector v(MAX_DATAGRAM_SIZE); + uint8_t * buf = v.data(); + auto identityLen = m_Identity.ToBuffer (buf, MAX_DATAGRAM_SIZE); uint8_t * signature = buf + identityLen; - auto signatureLen = i->GetSignatureLen (); + auto signatureLen = m_Identity.GetSignatureLen (); uint8_t * buf1 = signature + signatureLen; size_t headerLen = identityLen + signatureLen; memcpy (buf1, payload, len); - if (i->GetSigningKeyType () == i2p::data::SIGNING_KEY_TYPE_DSA_SHA1) + if (m_Identity.GetSigningKeyType () == i2p::data::SIGNING_KEY_TYPE_DSA_SHA1) { uint8_t hash[32]; SHA256(buf1, len, hash); @@ -48,7 +50,7 @@ namespace datagram } - void DatagramDestination::HandleDatagram (uint16_t fromPort, uint16_t toPort, const uint8_t * buf, size_t len) + void DatagramDestination::HandleDatagram (uint16_t fromPort, uint16_t toPort,uint8_t * const &buf, size_t len) { i2p::data::IdentityEx identity; size_t identityLen = identity.FromBuffer (buf, len); @@ -93,7 +95,7 @@ namespace datagram uint8_t uncompressed[MAX_DATAGRAM_SIZE]; size_t uncompressedLen = m_Inflator.Inflate (buf, len, uncompressed, MAX_DATAGRAM_SIZE); if (uncompressedLen) - HandleDatagram (fromPort, toPort, uncompressed, uncompressedLen); + HandleDatagram (fromPort, toPort, uncompressed, uncompressedLen); } std::shared_ptr DatagramDestination::CreateDataMessage (const uint8_t * payload, size_t len, uint16_t fromPort, uint16_t toPort) @@ -121,7 +123,7 @@ namespace datagram if (m_Sessions.empty ()) return; auto now = i2p::util::GetMillisecondsSinceEpoch(); LogPrint(eLogDebug, "DatagramDestination: clean up sessions"); - std::lock_guard lock(m_SessionsMutex); + std::unique_lock lock(m_SessionsMutex); // for each session ... for (auto it = m_Sessions.begin (); it != m_Sessions.end (); ) { @@ -270,13 +272,16 @@ namespace datagram bool DatagramSession::ShouldUpdateRoutingPath() const { + bool dead = m_RoutingSession == nullptr || m_RoutingSession->GetSharedRoutingPath () == nullptr; auto now = i2p::util::GetMillisecondsSinceEpoch (); // we need to rotate paths becuase the routing path is too old - if (now - m_LastPathChange >= DATAGRAM_SESSION_PATH_SWITCH_INTERVAL) return true; - // our path looks dead so we need to rotate paths - if (now - m_LastSuccess >= DATAGRAM_SESSION_PATH_TIMEOUT) return true; + // if (now - m_LastPathChange >= DATAGRAM_SESSION_PATH_SWITCH_INTERVAL) return true; + // too fast switching paths + if (now - m_LastPathChange < DATAGRAM_SESSION_PATH_MIN_LIFETIME ) return false; + // our path looks dead so we need to rotate paths + if (now - m_LastSuccess >= DATAGRAM_SESSION_PATH_TIMEOUT) return !dead; // if we have a routing session and routing path we don't need to switch paths - return m_RoutingSession == nullptr || m_RoutingSession->GetSharedRoutingPath () == nullptr; + return dead; } diff --git a/Datagram.h b/Datagram.h index f5397e56..aa7f3ba1 100644 --- a/Datagram.h +++ b/Datagram.h @@ -133,13 +133,14 @@ namespace datagram std::shared_ptr CreateDataMessage (const uint8_t * payload, size_t len, uint16_t fromPort, uint16_t toPort); - void HandleDatagram (uint16_t fromPort, uint16_t toPort, const uint8_t * buf, size_t len); + void HandleDatagram (uint16_t fromPort, uint16_t toPort, uint8_t *const& buf, size_t len); /** find a receiver by port, if none by port is found try default receiever, otherwise returns nullptr */ Receiver FindReceiver(uint16_t port); private: i2p::client::ClientDestination * m_Owner; + i2p::data::IdentityEx m_Identity; Receiver m_Receiver; // default std::mutex m_SessionsMutex; std::map > m_Sessions; diff --git a/I2PTunnel.cpp b/I2PTunnel.cpp index a9c5c313..a1814058 100644 --- a/I2PTunnel.cpp +++ b/I2PTunnel.cpp @@ -559,23 +559,23 @@ namespace client } /** create new udp session */ boost::asio::ip::udp::endpoint ep(m_LocalAddress, 0); - m_Sessions.push_back(new UDPSession(ep, m_LocalDest, m_RemoteEndpoint, ih, localPort, remotePort)); + m_Sessions.push_back(new UDPSession(ep, m_LocalDest, m_RemoteEndpoint, &ih, localPort, remotePort)); return m_Sessions.back(); } UDPSession::UDPSession(boost::asio::ip::udp::endpoint localEndpoint, const std::shared_ptr & localDestination, - boost::asio::ip::udp::endpoint endpoint, const i2p::data::IdentHash to, + boost::asio::ip::udp::endpoint endpoint, const i2p::data::IdentHash * to, uint16_t ourPort, uint16_t theirPort) : m_Destination(localDestination->GetDatagramDestination()), m_Service(localDestination->GetService()), IPSocket(localDestination->GetService(), localEndpoint), - Identity(to), SendEndpoint(endpoint), LastActivity(i2p::util::GetMillisecondsSinceEpoch()), LocalPort(ourPort), RemotePort(theirPort) { + memcpy(Identity, to->data(), 32); Receive(); } @@ -592,13 +592,7 @@ namespace client { LogPrint(eLogDebug, "UDPSession: forward ", len, "B from ", FromEndpoint); LastActivity = i2p::util::GetMillisecondsSinceEpoch(); - uint8_t * data = new uint8_t[len]; - memcpy(data, m_Buffer, len); - m_Service.post([&,len, data] () { - m_Destination->SendDatagramTo(data, len, Identity, 0, 0); - delete [] data; - }); - + m_Destination->SendDatagramTo(m_Buffer, len, Identity, 0, 0); Receive(); } else { LogPrint(eLogError, "UDPSession: ", ecode.message()); @@ -727,7 +721,7 @@ namespace client if(m_Session) delete m_Session; boost::asio::ip::udp::endpoint ep(boost::asio::ip::address::from_string("127.0.0.1"), 0); - m_Session = new UDPSession(m_LocalEndpoint, m_LocalDest, ep, *m_RemoteIdent, LocalPort, RemotePort); + m_Session = new UDPSession(m_LocalEndpoint, m_LocalDest, ep, m_RemoteIdent, LocalPort, RemotePort); } void I2PUDPClientTunnel::HandleRecvFromI2P(const i2p::data::IdentityEx& from, uint16_t /*fromPort*/, diff --git a/I2PTunnel.h b/I2PTunnel.h index dce9f812..e6f0e84f 100644 --- a/I2PTunnel.h +++ b/I2PTunnel.h @@ -155,7 +155,7 @@ namespace client UDPSession(boost::asio::ip::udp::endpoint localEndpoint, const std::shared_ptr & localDestination, - boost::asio::ip::udp::endpoint remote, const i2p::data::IdentHash ident, + boost::asio::ip::udp::endpoint remote, const i2p::data::IdentHash * ident, uint16_t ourPort, uint16_t theirPort); void HandleReceived(const boost::system::error_code & ecode, std::size_t len); void Receive(); From 7506619f4cde2e22197af117eb0943d1f5e4314c Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Sat, 8 Oct 2016 11:58:26 -0400 Subject: [PATCH 18/24] add minimum path lifetime --- Datagram.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Datagram.h b/Datagram.h index aa7f3ba1..614a4734 100644 --- a/Datagram.h +++ b/Datagram.h @@ -22,14 +22,15 @@ namespace datagram // milliseconds for max session idle time const uint64_t DATAGRAM_SESSION_MAX_IDLE = 10 * 60 * 1000; // milliseconds for how long we try sticking to a dead routing path before trying to switch - const uint64_t DATAGRAM_SESSION_PATH_TIMEOUT = 5000; + const uint64_t DATAGRAM_SESSION_PATH_TIMEOUT = 10 * 1000; // milliseconds interval a routing path is used before switching const uint64_t DATAGRAM_SESSION_PATH_SWITCH_INTERVAL = 20 * 60 * 1000; // milliseconds before lease expire should we try switching leases const uint64_t DATAGRAM_SESSION_LEASE_HANDOVER_WINDOW = 10 * 1000; // milliseconds fudge factor for leases handover const uint64_t DATAGRAM_SESSION_LEASE_HANDOVER_FUDGE = 1000; - + // milliseconds minimum time between path switches + const uint64_t DATAGRAM_SESSION_PATH_MIN_LIFETIME = 5 * 1000; class DatagramSession { From 8a95b5b5b0012cea0b3472f9885375463ce4d7c9 Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Mon, 10 Oct 2016 08:30:33 -0400 Subject: [PATCH 19/24] tabify --- Datagram.cpp | 6 +++--- Datagram.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Datagram.cpp b/Datagram.cpp index 0fce1166..d0b0737a 100644 --- a/Datagram.cpp +++ b/Datagram.cpp @@ -276,9 +276,9 @@ namespace datagram auto now = i2p::util::GetMillisecondsSinceEpoch (); // we need to rotate paths becuase the routing path is too old // if (now - m_LastPathChange >= DATAGRAM_SESSION_PATH_SWITCH_INTERVAL) return true; - // too fast switching paths - if (now - m_LastPathChange < DATAGRAM_SESSION_PATH_MIN_LIFETIME ) return false; - // our path looks dead so we need to rotate paths + // too fast switching paths + if (now - m_LastPathChange < DATAGRAM_SESSION_PATH_MIN_LIFETIME ) return false; + // our path looks dead so we need to rotate paths if (now - m_LastSuccess >= DATAGRAM_SESSION_PATH_TIMEOUT) return !dead; // if we have a routing session and routing path we don't need to switch paths return dead; diff --git a/Datagram.h b/Datagram.h index 614a4734..dc63cccb 100644 --- a/Datagram.h +++ b/Datagram.h @@ -29,8 +29,8 @@ namespace datagram const uint64_t DATAGRAM_SESSION_LEASE_HANDOVER_WINDOW = 10 * 1000; // milliseconds fudge factor for leases handover const uint64_t DATAGRAM_SESSION_LEASE_HANDOVER_FUDGE = 1000; - // milliseconds minimum time between path switches - const uint64_t DATAGRAM_SESSION_PATH_MIN_LIFETIME = 5 * 1000; + // milliseconds minimum time between path switches + const uint64_t DATAGRAM_SESSION_PATH_MIN_LIFETIME = 5 * 1000; class DatagramSession { From 84ca992e9128f78bc147e510fd2a2895d77a1e4f Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Mon, 10 Oct 2016 08:59:48 -0400 Subject: [PATCH 20/24] Revert "Unused parameter warnings removal" This reverts commit 5350078543d0ac04a608f2c03efd4b9e1b8f9509. --- AddressBook.cpp | 3 +-- BOB.cpp | 42 +++++++++++++++++++++--------------------- Destination.cpp | 6 +++--- Family.cpp | 2 +- I2CP.cpp | 15 +++++++-------- I2PControl.cpp | 8 ++++---- I2PTunnel.cpp | 5 ++--- LeaseSet.cpp | 2 +- RouterContext.cpp | 2 +- SAM.cpp | 15 +++++++-------- SOCKS.cpp | 4 ++-- SSUSession.cpp | 6 +++--- Streaming.cpp | 2 +- TransitTunnel.cpp | 4 ++-- Transports.cpp | 4 ++-- Tunnel.cpp | 6 +++--- 16 files changed, 61 insertions(+), 65 deletions(-) diff --git a/AddressBook.cpp b/AddressBook.cpp index 67eb7566..b993f456 100644 --- a/AddressBook.cpp +++ b/AddressBook.cpp @@ -599,8 +599,7 @@ namespace client } } - void AddressBook::HandleLookupResponse (const i2p::data::IdentityEx& from, uint16_t /*fromPort*/, - uint16_t /*toPort*/, const uint8_t * buf, size_t len) + void AddressBook::HandleLookupResponse (const i2p::data::IdentityEx& from, uint16_t fromPort, uint16_t toPort, const uint8_t * buf, size_t len) { if (len < 44) { diff --git a/BOB.cpp b/BOB.cpp index 2d96f4b2..8ffffba6 100644 --- a/BOB.cpp +++ b/BOB.cpp @@ -284,7 +284,7 @@ namespace client std::placeholders::_1, std::placeholders::_2)); } - void BOBCommandSession::HandleSent (const boost::system::error_code& ecode, std::size_t /*bytes_transferred*/) + void BOBCommandSession::HandleSent (const boost::system::error_code& ecode, std::size_t bytes_transferred) { if (ecode) { @@ -338,20 +338,20 @@ namespace client Send (len); } - void BOBCommandSession::ZapCommandHandler (const char * /*operand*/, size_t /*len*/) + void BOBCommandSession::ZapCommandHandler (const char * operand, size_t len) { LogPrint (eLogDebug, "BOB: zap"); Terminate (); } - void BOBCommandSession::QuitCommandHandler (const char * /*operand*/, size_t /*len*/) + void BOBCommandSession::QuitCommandHandler (const char * operand, size_t len) { LogPrint (eLogDebug, "BOB: quit"); m_IsOpen = false; SendReplyOK ("Bye!"); } - void BOBCommandSession::StartCommandHandler (const char * /*operand*/, size_t /*len*/) + void BOBCommandSession::StartCommandHandler (const char * operand, size_t len) { LogPrint (eLogDebug, "BOB: start ", m_Nickname); if (m_IsActive) @@ -373,7 +373,7 @@ namespace client m_IsActive = true; } - void BOBCommandSession::StopCommandHandler (const char * /*operand*/, size_t /*len*/) + void BOBCommandSession::StopCommandHandler (const char * operand, size_t len) { LogPrint (eLogDebug, "BOB: stop ", m_Nickname); if (!m_IsActive) @@ -392,7 +392,7 @@ namespace client m_IsActive = false; } - void BOBCommandSession::SetNickCommandHandler (const char * operand, size_t /*len*/) + void BOBCommandSession::SetNickCommandHandler (const char * operand, size_t len) { LogPrint (eLogDebug, "BOB: setnick ", operand); m_Nickname = operand; @@ -401,7 +401,7 @@ namespace client SendReplyOK (msg.c_str ()); } - void BOBCommandSession::GetNickCommandHandler (const char * operand, size_t /*len*/) + void BOBCommandSession::GetNickCommandHandler (const char * operand, size_t len) { LogPrint (eLogDebug, "BOB: getnick ", operand); m_CurrentDestination = m_Owner.FindDestination (operand); @@ -420,40 +420,40 @@ namespace client SendReplyError ("no nickname has been set"); } - void BOBCommandSession::NewkeysCommandHandler (const char* /*operand*/, size_t /*len*/) + void BOBCommandSession::NewkeysCommandHandler (const char * operand, size_t len) { LogPrint (eLogDebug, "BOB: newkeys"); m_Keys = i2p::data::PrivateKeys::CreateRandomKeys (); SendReplyOK (m_Keys.GetPublic ()->ToBase64 ().c_str ()); } - void BOBCommandSession::SetkeysCommandHandler (const char* operand, size_t /*len*/) + void BOBCommandSession::SetkeysCommandHandler (const char * operand, size_t len) { LogPrint (eLogDebug, "BOB: setkeys ", operand); m_Keys.FromBase64 (operand); SendReplyOK (m_Keys.GetPublic ()->ToBase64 ().c_str ()); } - void BOBCommandSession::GetkeysCommandHandler (const char* /*operand*/, size_t /*len*/) + void BOBCommandSession::GetkeysCommandHandler (const char * operand, size_t len) { LogPrint (eLogDebug, "BOB: getkeys"); SendReplyOK (m_Keys.ToBase64 ().c_str ()); } - void BOBCommandSession::GetdestCommandHandler (const char* /*operand*/, size_t /*len*/) + void BOBCommandSession::GetdestCommandHandler (const char * operand, size_t len) { LogPrint (eLogDebug, "BOB: getdest"); SendReplyOK (m_Keys.GetPublic ()->ToBase64 ().c_str ()); } - void BOBCommandSession::OuthostCommandHandler (const char* operand, size_t /*len*/) + void BOBCommandSession::OuthostCommandHandler (const char * operand, size_t len) { LogPrint (eLogDebug, "BOB: outhost ", operand); m_Address = operand; SendReplyOK ("outhost set"); } - void BOBCommandSession::OutportCommandHandler (const char* operand, size_t /*len*/) + void BOBCommandSession::OutportCommandHandler (const char * operand, size_t len) { LogPrint (eLogDebug, "BOB: outport ", operand); m_OutPort = boost::lexical_cast(operand); @@ -463,14 +463,14 @@ namespace client SendReplyError ("port out of range"); } - void BOBCommandSession::InhostCommandHandler (const char* operand, size_t /*len*/) + void BOBCommandSession::InhostCommandHandler (const char * operand, size_t len) { LogPrint (eLogDebug, "BOB: inhost ", operand); m_Address = operand; SendReplyOK ("inhost set"); } - void BOBCommandSession::InportCommandHandler (const char* operand, size_t /*len*/) + void BOBCommandSession::InportCommandHandler (const char * operand, size_t len) { LogPrint (eLogDebug, "BOB: inport ", operand); m_InPort = boost::lexical_cast(operand); @@ -480,7 +480,7 @@ namespace client SendReplyError ("port out of range"); } - void BOBCommandSession::QuietCommandHandler (const char* /*operand*/, size_t /*len*/) + void BOBCommandSession::QuietCommandHandler (const char * operand, size_t len) { LogPrint (eLogDebug, "BOB: quiet"); if (m_Nickname.length () > 0) @@ -497,7 +497,7 @@ namespace client SendReplyError ("no nickname has been set"); } - void BOBCommandSession::LookupCommandHandler (const char* operand, size_t /*len*/) + void BOBCommandSession::LookupCommandHandler (const char * operand, size_t len) { LogPrint (eLogDebug, "BOB: lookup ", operand); i2p::data::IdentHash ident; @@ -525,7 +525,7 @@ namespace client } } - void BOBCommandSession::ClearCommandHandler (const char* /*operand*/, size_t /*len*/) + void BOBCommandSession::ClearCommandHandler (const char * operand, size_t len) { LogPrint (eLogDebug, "BOB: clear"); m_Owner.DeleteDestination (m_Nickname); @@ -533,7 +533,7 @@ namespace client SendReplyOK ("cleared"); } - void BOBCommandSession::ListCommandHandler (const char* /*operand*/, size_t /*len*/) + void BOBCommandSession::ListCommandHandler (const char * operand, size_t len) { LogPrint (eLogDebug, "BOB: list"); const auto& destinations = m_Owner.GetDestinations (); @@ -542,7 +542,7 @@ namespace client SendReplyOK ("Listing done"); } - void BOBCommandSession::OptionCommandHandler (const char* operand, size_t /*len*/) + void BOBCommandSession::OptionCommandHandler (const char * operand, size_t len) { LogPrint (eLogDebug, "BOB: option ", operand); const char * value = strchr (operand, '='); @@ -561,7 +561,7 @@ namespace client SendReplyError ("malformed"); } - void BOBCommandSession::StatusCommandHandler (const char* operand, size_t /*len*/) + void BOBCommandSession::StatusCommandHandler (const char * operand, size_t len) { LogPrint (eLogDebug, "BOB: status ", operand); if (m_Nickname == operand) diff --git a/Destination.cpp b/Destination.cpp index d859d6b0..0b8f2859 100644 --- a/Destination.cpp +++ b/Destination.cpp @@ -260,7 +260,7 @@ namespace client m_Service.post (std::bind (&LeaseSetDestination::HandleDeliveryStatusMessage, shared_from_this (), msg)); } - void LeaseSetDestination::HandleI2NPMessage (const uint8_t * buf, size_t /*len*/, std::shared_ptr from) + void LeaseSetDestination::HandleI2NPMessage (const uint8_t * buf, size_t len, std::shared_ptr from) { uint8_t typeID = buf[I2NP_HEADER_TYPEID_OFFSET]; switch (typeID) @@ -348,7 +348,7 @@ namespace client } } - void LeaseSetDestination::HandleDatabaseSearchReplyMessage (const uint8_t * buf, size_t /*len*/) + void LeaseSetDestination::HandleDatabaseSearchReplyMessage (const uint8_t * buf, size_t len) { i2p::data::IdentHash key (buf); int num = buf[32]; // num @@ -732,7 +732,7 @@ namespace client ScheduleCheckForReady(p); } - void ClientDestination::HandleDataMessage (const uint8_t * buf, size_t /*len*/) + void ClientDestination::HandleDataMessage (const uint8_t * buf, size_t len) { uint32_t length = bufbe32toh (buf); buf += 4; diff --git a/Family.cpp b/Family.cpp index b37af204..c1840e51 100644 --- a/Family.cpp +++ b/Family.cpp @@ -110,7 +110,7 @@ namespace data } bool Families::VerifyFamily (const std::string& family, const IdentHash& ident, - const char * signature, const char * /*key*/) + const char * signature, const char * key) { uint8_t buf[50], signatureBuf[64]; size_t len = family.length (), signatureLen = strlen (signature); diff --git a/I2CP.cpp b/I2CP.cpp index 7100250e..04f21408 100644 --- a/I2CP.cpp +++ b/I2CP.cpp @@ -197,7 +197,7 @@ namespace client std::bind (&I2CPSession::HandleReceivedHeader, shared_from_this (), std::placeholders::_1, std::placeholders::_2)); } - void I2CPSession::HandleReceivedHeader (const boost::system::error_code& ecode, std::size_t /*bytes_transferred*/) + void I2CPSession::HandleReceivedHeader (const boost::system::error_code& ecode, std::size_t bytes_transferred) { if (ecode) Terminate (); @@ -224,7 +224,7 @@ namespace client std::bind (&I2CPSession::HandleReceivedPayload, shared_from_this (), std::placeholders::_1, std::placeholders::_2)); } - void I2CPSession::HandleReceivedPayload (const boost::system::error_code& ecode, std::size_t /*bytes_transferred*/) + void I2CPSession::HandleReceivedPayload (const boost::system::error_code& ecode, std::size_t bytes_transferred) { if (ecode) Terminate (); @@ -281,8 +281,7 @@ namespace client LogPrint (eLogError, "I2CP: Can't write to the socket"); } - void I2CPSession::HandleI2CPMessageSent (const boost::system::error_code& ecode, - std::size_t /*bytes_transferred*/, const uint8_t* buf) + void I2CPSession::HandleI2CPMessageSent (const boost::system::error_code& ecode, std::size_t bytes_transferred, const uint8_t * buf) { delete[] buf; if (ecode && ecode != boost::asio::error::operation_aborted) @@ -397,7 +396,7 @@ namespace client } } - void I2CPSession::DestroySessionMessageHandler (const uint8_t* /*buf*/, size_t /*len*/) + void I2CPSession::DestroySessionMessageHandler (const uint8_t * buf, size_t len) { SendSessionStatusMessage (0); // destroy LogPrint (eLogDebug, "I2CP: session ", m_SessionID, " destroyed"); @@ -408,7 +407,7 @@ namespace client } } - void I2CPSession::ReconfigureSessionMessageHandler (const uint8_t* /*buf*/, size_t /*len*/) + void I2CPSession::ReconfigureSessionMessageHandler (const uint8_t * buf, size_t len) { // TODO: implement actual reconfiguration SendSessionStatusMessage (2); // updated @@ -570,7 +569,7 @@ namespace client } } - void I2CPSession::DestLookupMessageHandler (const uint8_t * buf, size_t /*len*/) + void I2CPSession::DestLookupMessageHandler (const uint8_t * buf, size_t len) { if (m_Destination) { @@ -607,7 +606,7 @@ namespace client SendI2CPMessage (I2CP_DEST_REPLY_MESSAGE, buf, 32); } - void I2CPSession::GetBandwidthLimitsMessageHandler (const uint8_t* /*buf*/, size_t /*len*/) + void I2CPSession::GetBandwidthLimitsMessageHandler (const uint8_t * buf, size_t len) { uint8_t limits[64]; memset (limits, 0, 64); diff --git a/I2PControl.cpp b/I2PControl.cpp index 7f063f35..3e2e3997 100644 --- a/I2PControl.cpp +++ b/I2PControl.cpp @@ -295,8 +295,8 @@ namespace client std::placeholders::_1, std::placeholders::_2, socket, buf)); } - void I2PControlService::HandleResponseSent (const boost::system::error_code& ecode, std::size_t /*bytes_transferred*/, - std::shared_ptr /*socket*/, std::shared_ptr /*buf*/) + void I2PControlService::HandleResponseSent (const boost::system::error_code& ecode, std::size_t bytes_transferred, + std::shared_ptr socket, std::shared_ptr buf) { if (ecode) { LogPrint (eLogError, "I2PControl: write error: ", ecode.message ()); @@ -453,7 +453,7 @@ namespace client InsertParam (results, "Shutdown", ""); m_ShutdownTimer.expires_from_now (boost::posix_time::seconds(1)); // 1 second to make sure response has been sent m_ShutdownTimer.async_wait ( - [](const boost::system::error_code&) + [](const boost::system::error_code& ecode) { Daemon.running = 0; }); @@ -467,7 +467,7 @@ namespace client InsertParam (results, "ShutdownGraceful", ""); m_ShutdownTimer.expires_from_now (boost::posix_time::seconds(timeout + 1)); // + 1 second m_ShutdownTimer.async_wait ( - [](const boost::system::error_code&) + [](const boost::system::error_code& ecode) { Daemon.running = 0; }); diff --git a/I2PTunnel.cpp b/I2PTunnel.cpp index a1814058..be48b83a 100644 --- a/I2PTunnel.cpp +++ b/I2PTunnel.cpp @@ -439,7 +439,7 @@ namespace client } void I2PServerTunnel::HandleResolve (const boost::system::error_code& ecode, boost::asio::ip::tcp::resolver::iterator it, - std::shared_ptr /*resolver*/) + std::shared_ptr resolver) { if (!ecode) { @@ -724,8 +724,7 @@ namespace client m_Session = new UDPSession(m_LocalEndpoint, m_LocalDest, ep, m_RemoteIdent, LocalPort, RemotePort); } - void I2PUDPClientTunnel::HandleRecvFromI2P(const i2p::data::IdentityEx& from, uint16_t /*fromPort*/, - uint16_t /*toPort*/, const uint8_t * buf, size_t len) + void I2PUDPClientTunnel::HandleRecvFromI2P(const i2p::data::IdentityEx& from, uint16_t fromPort, uint16_t toPort, const uint8_t * buf, size_t len) { if(m_RemoteIdent && from.GetIdentHash() == *m_RemoteIdent) { diff --git a/LeaseSet.cpp b/LeaseSet.cpp index 4ddd07f3..04dc77c5 100644 --- a/LeaseSet.cpp +++ b/LeaseSet.cpp @@ -173,7 +173,7 @@ namespace data const std::vector > LeaseSet::GetNonExpiredLeases (bool withThreshold) const { - return GetNonExpiredLeasesExcluding( [] (const Lease &) -> bool { return false; }, withThreshold); + return GetNonExpiredLeasesExcluding( [] (const Lease & l) -> bool { return false; }, withThreshold); } const std::vector > LeaseSet::GetNonExpiredLeasesExcluding (LeaseInspectFunc exclude, bool withThreshold) const diff --git a/RouterContext.cpp b/RouterContext.cpp index 15084bd3..6824adb8 100644 --- a/RouterContext.cpp +++ b/RouterContext.cpp @@ -424,7 +424,7 @@ namespace i2p return i2p::tunnel::tunnels.GetExploratoryPool (); } - void RouterContext::HandleI2NPMessage (const uint8_t * buf, size_t /*len*/, std::shared_ptr from) + void RouterContext::HandleI2NPMessage (const uint8_t * buf, size_t len, std::shared_ptr from) { i2p::HandleI2NPMessage (CreateI2NPMessage (buf, GetI2NPMessageLength (buf), from)); } diff --git a/SAM.cpp b/SAM.cpp index ce85fc8d..2864cd6f 100644 --- a/SAM.cpp +++ b/SAM.cpp @@ -135,7 +135,7 @@ namespace client } } - void SAMSocket::HandleHandshakeReplySent (const boost::system::error_code& ecode, std::size_t /*bytes_transferred*/) + void SAMSocket::HandleHandshakeReplySent (const boost::system::error_code& ecode, std::size_t bytes_transferred) { if (ecode) { @@ -166,7 +166,7 @@ namespace client } } - void SAMSocket::HandleMessageReplySent (const boost::system::error_code& ecode, std::size_t /*bytes_transferred*/, bool close) + void SAMSocket::HandleMessageReplySent (const boost::system::error_code& ecode, std::size_t bytes_transferred, bool close) { if (ecode) { @@ -262,7 +262,7 @@ namespace client } } - void SAMSocket::ProcessSessionCreate (char * buf, size_t /*len*/) + void SAMSocket::ProcessSessionCreate (char * buf, size_t len) { LogPrint (eLogDebug, "SAM: session create: ", buf); std::map params; @@ -333,7 +333,7 @@ namespace client SendMessageReply (m_Buffer, l2, false); } - void SAMSocket::ProcessStreamConnect (char * buf, size_t /*len*/) + void SAMSocket::ProcessStreamConnect (char * buf, size_t len) { LogPrint (eLogDebug, "SAM: stream connect: ", buf); std::map params; @@ -389,7 +389,7 @@ namespace client } } - void SAMSocket::ProcessStreamAccept (char * buf, size_t /*len*/) + void SAMSocket::ProcessStreamAccept (char * buf, size_t len) { LogPrint (eLogDebug, "SAM: stream accept: ", buf); std::map params; @@ -460,7 +460,7 @@ namespace client SendMessageReply (m_Buffer, len, false); } - void SAMSocket::ProcessNamingLookup (char * buf, size_t /*len*/) + void SAMSocket::ProcessNamingLookup (char * buf, size_t len) { LogPrint (eLogDebug, "SAM: naming lookup: ", buf); std::map params; @@ -652,8 +652,7 @@ namespace client LogPrint (eLogWarning, "SAM: I2P acceptor has been reset"); } - void SAMSocket::HandleI2PDatagramReceive (const i2p::data::IdentityEx& from, uint16_t /*fromPort*/, - uint16_t /*toPort*/, const uint8_t* buf, size_t len) + void SAMSocket::HandleI2PDatagramReceive (const i2p::data::IdentityEx& from, uint16_t fromPort, uint16_t toPort, const uint8_t * buf, size_t len) { LogPrint (eLogDebug, "SAM: datagram received ", len); auto base64 = from.ToBase64 (); diff --git a/SOCKS.cpp b/SOCKS.cpp index a52fe612..9d85963b 100644 --- a/SOCKS.cpp +++ b/SOCKS.cpp @@ -696,7 +696,7 @@ namespace proxy } - void SOCKSHandler::HandleUpstreamData(uint8_t* /*dataptr*/, std::size_t len) + void SOCKSHandler::HandleUpstreamData(uint8_t * dataptr, std::size_t len) { if (m_state == UPSTREAM_HANDSHAKE) { m_upstream_response_len += len; @@ -739,7 +739,7 @@ namespace proxy } } - void SOCKSHandler::HandleUpstreamConnected(const boost::system::error_code & ecode, boost::asio::ip::tcp::resolver::iterator) + void SOCKSHandler::HandleUpstreamConnected(const boost::system::error_code & ecode, boost::asio::ip::tcp::resolver::iterator itr) { if (ecode) { LogPrint(eLogWarning, "SOCKS: could not connect to upstream proxy: ", ecode.message()); diff --git a/SSUSession.cpp b/SSUSession.cpp index fbb5b11d..5cd59164 100644 --- a/SSUSession.cpp +++ b/SSUSession.cpp @@ -536,7 +536,7 @@ namespace transport Send (buf, msgLen); } - void SSUSession::ProcessRelayRequest (const uint8_t * buf, size_t /*len*/, const boost::asio::ip::udp::endpoint& from) + void SSUSession::ProcessRelayRequest (const uint8_t * buf, size_t len, const boost::asio::ip::udp::endpoint& from) { uint32_t relayTag = bufbe32toh (buf); auto session = m_Server.FindRelaySession (relayTag); @@ -637,7 +637,7 @@ namespace transport LogPrint (eLogDebug, "SSU: relay intro sent"); } - void SSUSession::ProcessRelayResponse (const uint8_t * buf, size_t /*len*/) + void SSUSession::ProcessRelayResponse (const uint8_t * buf, size_t len) { LogPrint (eLogDebug, "SSU message: Relay response received"); uint8_t remoteSize = *buf; @@ -689,7 +689,7 @@ namespace transport LogPrint (eLogError, "SSU: Unsolicited RelayResponse, nonce=", nonce); } - void SSUSession::ProcessRelayIntro (const uint8_t * buf, size_t /*len*/) + void SSUSession::ProcessRelayIntro (const uint8_t * buf, size_t len) { uint8_t size = *buf; if (size == 4) diff --git a/Streaming.cpp b/Streaming.cpp index e8f5a897..02e738c8 100644 --- a/Streaming.cpp +++ b/Streaming.cpp @@ -729,7 +729,7 @@ namespace stream } } - void Stream::HandleAckSendTimer (const boost::system::error_code&) + void Stream::HandleAckSendTimer (const boost::system::error_code& ecode) { if (m_IsAckSendScheduled) { diff --git a/TransitTunnel.cpp b/TransitTunnel.cpp index d06f5134..dfe01a05 100644 --- a/TransitTunnel.cpp +++ b/TransitTunnel.cpp @@ -51,12 +51,12 @@ namespace tunnel } } - void TransitTunnel::SendTunnelDataMsg (std::shared_ptr /*msg*/) + void TransitTunnel::SendTunnelDataMsg (std::shared_ptr msg) { LogPrint (eLogError, "TransitTunnel: We are not a gateway for ", GetTunnelID ()); } - void TransitTunnel::HandleTunnelDataMsg (std::shared_ptr /*msg*/) + void TransitTunnel::HandleTunnelDataMsg (std::shared_ptr tunnelMsg) { LogPrint (eLogError, "TransitTunnel: Incoming tunnel message is not supported ", GetTunnelID ()); } diff --git a/Transports.cpp b/Transports.cpp index e0d2df7a..a29cac15 100644 --- a/Transports.cpp +++ b/Transports.cpp @@ -394,7 +394,7 @@ namespace transport } void Transports::HandleNTCPResolve (const boost::system::error_code& ecode, boost::asio::ip::tcp::resolver::iterator it, - i2p::data::IdentHash ident, std::shared_ptr /*resolver*/) + i2p::data::IdentHash ident, std::shared_ptr resolver) { auto it1 = m_Peers.find (ident); if (it1 != m_Peers.end ()) @@ -437,7 +437,7 @@ namespace transport } void Transports::HandleSSUResolve (const boost::system::error_code& ecode, boost::asio::ip::tcp::resolver::iterator it, - i2p::data::IdentHash ident, std::shared_ptr /*resolver*/) + i2p::data::IdentHash ident, std::shared_ptr resolver) { auto it1 = m_Peers.find (ident); if (it1 != m_Peers.end ()) diff --git a/Tunnel.cpp b/Tunnel.cpp index 3749c9ca..7d2e6735 100644 --- a/Tunnel.cpp +++ b/Tunnel.cpp @@ -90,7 +90,7 @@ namespace tunnel i2p::transport::transports.SendMessage (GetNextIdentHash (), msg); } - bool Tunnel::HandleTunnelBuildResponse (uint8_t * msg, size_t /*len*/) + bool Tunnel::HandleTunnelBuildResponse (uint8_t * msg, size_t len) { LogPrint (eLogDebug, "Tunnel: TunnelBuildResponse ", (int)msg[0], " records."); @@ -161,7 +161,7 @@ namespace tunnel } } - void Tunnel::SendTunnelDataMsg (std::shared_ptr /*msg*/) + void Tunnel::SendTunnelDataMsg (std::shared_ptr msg) { LogPrint (eLogWarning, "Tunnel: Can't send I2NP messages without delivery instructions"); } @@ -256,7 +256,7 @@ namespace tunnel m_Gateway.SendBuffer (); } - void OutboundTunnel::HandleTunnelDataMsg (std::shared_ptr /*msg*/) + void OutboundTunnel::HandleTunnelDataMsg (std::shared_ptr tunnelMsg) { LogPrint (eLogError, "Tunnel: incoming message for outbound tunnel ", GetTunnelID ()); } From a332d687043959cc57fd7015e4cb98123e25103b Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Mon, 10 Oct 2016 09:02:39 -0400 Subject: [PATCH 21/24] Revert "fix f79ad91" This reverts commit e8e3db688803309c7411b29f7b6ca0c159872f98. --- Destination.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Destination.cpp b/Destination.cpp index 0b8f2859..dbdec0c7 100644 --- a/Destination.cpp +++ b/Destination.cpp @@ -185,7 +185,6 @@ namespace client if(ls && !ls->IsExpired()) { ls->PopulateLeases(); - std::unique_lock lock(m_RemoteLeaseSetsMutex); m_RemoteLeaseSets[ident] = ls; } }); From 3095e142474b46227f991adfe7e05772eec1083e Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Mon, 10 Oct 2016 09:04:24 -0400 Subject: [PATCH 22/24] undo weird mutex changes --- Destination.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Destination.cpp b/Destination.cpp index dbdec0c7..a1e1858e 100644 --- a/Destination.cpp +++ b/Destination.cpp @@ -171,7 +171,7 @@ namespace client std::shared_ptr LeaseSetDestination::FindLeaseSet (const i2p::data::IdentHash& ident) { - std::unique_lock lock(m_RemoteLeaseSetsMutex); + std::lock_guard lock(m_RemoteLeaseSetsMutex); auto it = m_RemoteLeaseSets.find (ident); if (it != m_RemoteLeaseSets.end ()) { @@ -185,7 +185,10 @@ namespace client if(ls && !ls->IsExpired()) { ls->PopulateLeases(); - m_RemoteLeaseSets[ident] = ls; + { + std::lock_guard l(m_RemoteLeaseSetsMutex); + m_RemoteLeaseSets[ident] = ls; + } } }); } From 456d9e79e61214c16fadbcc447e3893b78d32942 Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Mon, 10 Oct 2016 09:06:32 -0400 Subject: [PATCH 23/24] Revert "minimize count of errors "I2CP: Failed to send message. No outbound tunnels"" This reverts commit 8ff2627e8eef895bc840d335aeca5db947077d79. --- I2CP.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/I2CP.cpp b/I2CP.cpp index 04f21408..e0139b9f 100644 --- a/I2CP.cpp +++ b/I2CP.cpp @@ -103,8 +103,7 @@ namespace client } auto path = remoteSession->GetSharedRoutingPath (); std::shared_ptr outboundTunnel; - std::shared_ptr remoteLease; - bool unconfirmedTags=false; + std::shared_ptr remoteLease; if (path) { if (!remoteSession->CleanupUnconfirmedTags ()) // no stuck tags @@ -113,12 +112,9 @@ namespace client remoteLease = path->remoteLease; } else - { remoteSession->SetSharedRoutingPath (nullptr); - unconfirmedTags=true; - } } - if (!path || unconfirmedTags) + else { outboundTunnel = GetTunnelPool ()->GetNextOutboundTunnel (); auto leases = remote->GetNonExpiredLeases (); From e8d8b290a69b47827e40ade735d1a7c1024fa26a Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Mon, 10 Oct 2016 09:07:49 -0400 Subject: [PATCH 24/24] rename --- Destination.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Destination.cpp b/Destination.cpp index a1e1858e..ccf1e6e2 100644 --- a/Destination.cpp +++ b/Destination.cpp @@ -186,7 +186,7 @@ namespace client { ls->PopulateLeases(); { - std::lock_guard l(m_RemoteLeaseSetsMutex); + std::lock_guard _lock(m_RemoteLeaseSetsMutex); m_RemoteLeaseSets[ident] = ls; } }