From d025ba279334a718d3f62be1c59fbe4d90e096e2 Mon Sep 17 00:00:00 2001 From: alexandr Date: Mon, 26 Sep 2016 01:37:00 +0500 Subject: [PATCH 1/6] 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 2/6] 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 3/6] 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 4/6] 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 e8e3db688803309c7411b29f7b6ca0c159872f98 Mon Sep 17 00:00:00 2001 From: alexandr Date: Wed, 5 Oct 2016 01:20:43 +0500 Subject: [PATCH 5/6] 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 6/6] 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 $@