From 32669cb07fe112dea5d677f7e55729ee3918640d Mon Sep 17 00:00:00 2001 From: orignal Date: Wed, 24 Aug 2016 12:34:18 -0400 Subject: [PATCH 1/6] stop termination timer on shutdown --- SSU.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SSU.cpp b/SSU.cpp index 3d3fefdd..72091e00 100644 --- a/SSU.cpp +++ b/SSU.cpp @@ -77,6 +77,8 @@ namespace transport { DeleteAllSessions (); m_IsRunning = false; + m_TerminationTimer.cancel (); + m_TerminationTimerV6.cancel (); m_Service.stop (); m_Socket.close (); m_ServiceV6.stop (); From c4171a01bdd9e173bdc644665c2bc12eab31948b Mon Sep 17 00:00:00 2001 From: orignal Date: Fri, 26 Aug 2016 09:48:19 -0400 Subject: [PATCH 2/6] fix #622. extract correct CN --- Reseed.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Reseed.cpp b/Reseed.cpp index 48d7a53f..21635791 100644 --- a/Reseed.cpp +++ b/Reseed.cpp @@ -345,11 +345,21 @@ namespace data // extract issuer name char name[100]; X509_NAME_oneline (X509_get_issuer_name(cert), name, 100); + char * cn = strstr (name, "CN="); + if (cn) + { + cn += 3; + char * terminator = strchr (cn, '/'); + if (terminator) terminator[0] = 0; + } // extract RSA key (we need n only, e = 65537) RSA * key = X509_get_pubkey (cert)->pkey.rsa; PublicKey value; i2p::crypto::bn2buf (key->n, value, 512); - m_SigningKeys[name] = value; + if (cn) + m_SigningKeys[cn] = value; + else + LogPrint (eLogError, "Reseed: Can't find CN field in ", filename); } SSL_free (ssl); } From fc5fc5bbee016b41ab447b2a9960b0d96f5733f0 Mon Sep 17 00:00:00 2001 From: orignal Date: Fri, 26 Aug 2016 10:06:28 -0400 Subject: [PATCH 3/6] don't throw exception if connection failed --- NTCPSession.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NTCPSession.cpp b/NTCPSession.cpp index 41252f97..10af063d 100644 --- a/NTCPSession.cpp +++ b/NTCPSession.cpp @@ -952,7 +952,7 @@ namespace transport { if (ecode) { - LogPrint (eLogError, "NTCP: Can't connect to ", conn->GetSocket ().remote_endpoint (), ": ", ecode.message ()); + LogPrint (eLogError, "NTCP: Connect error ", ecode.message ()); if (ecode != boost::asio::error::operation_aborted) i2p::data::netdb.SetUnreachable (conn->GetRemoteIdentity ()->GetIdentHash (), true); conn->Terminate (); From 205b61e4cf334307ff38fcc7dafffc7ae616ba9c Mon Sep 17 00:00:00 2001 From: hagen Date: Fri, 26 Aug 2016 14:00:00 +0000 Subject: [PATCH 4/6] * HTTPServer : fix tag --- HTTPServer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HTTPServer.cpp b/HTTPServer.cpp index fdc5b38f..52ef09e3 100644 --- a/HTTPServer.cpp +++ b/HTTPServer.cpp @@ -422,7 +422,7 @@ namespace http { s << " Accept transit tunnels
\r\n"; #if (!defined(WIN32) && !defined(QT_GUI_LIB) && !defined(ANDROID)) if (Daemon.gracefullShutdownInterval) - s << " Cancel gracefull shutdown
"; + s << " Cancel gracefull shutdown
"; else s << " Start gracefull shutdown
\r\n"; #endif From 26440d94f1ea4c75cf9a450eeb9c7c2a70f8ec4e Mon Sep 17 00:00:00 2001 From: hagen Date: Fri, 26 Aug 2016 14:00:00 +0000 Subject: [PATCH 5/6] * HTTPServer : keep response data for async_write() --- HTTPServer.cpp | 4 ++-- HTTPServer.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/HTTPServer.cpp b/HTTPServer.cpp index 52ef09e3..309e3f6b 100644 --- a/HTTPServer.cpp +++ b/HTTPServer.cpp @@ -762,8 +762,8 @@ namespace http { reply.add_header("Content-Type", "text/html"); reply.body = content; - std::string res = reply.to_string(); - boost::asio::async_write (*m_Socket, boost::asio::buffer(res), + m_SendBuffer = reply.to_string(); + boost::asio::async_write (*m_Socket, boost::asio::buffer(m_SendBuffer), std::bind (&HTTPConnection::Terminate, shared_from_this (), std::placeholders::_1)); } diff --git a/HTTPServer.h b/HTTPServer.h index bf7f5c65..5246af8b 100644 --- a/HTTPServer.h +++ b/HTTPServer.h @@ -31,6 +31,7 @@ namespace http { boost::asio::deadline_timer m_Timer; char m_Buffer[HTTP_CONNECTION_BUFFER_SIZE + 1]; size_t m_BufferLen; + std::string m_SendBuffer; bool needAuth; std::string user; std::string pass; From 37b80f0ce3fc6b867db2e1941b36f4eca41da0bf Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Mon, 29 Aug 2016 10:41:15 -0400 Subject: [PATCH 6/6] make sure m_RTO > 0 in Streaming.cpp so it doesn't hang --- Streaming.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Streaming.cpp b/Streaming.cpp index 90c363ea..1103dba1 100644 --- a/Streaming.cpp +++ b/Streaming.cpp @@ -658,6 +658,9 @@ namespace stream void Stream::ScheduleResend () { m_ResendTimer.cancel (); + // check for invalid value + if (m_RTO <= 0) + m_RTO = 1; m_ResendTimer.expires_from_now (boost::posix_time::milliseconds(m_RTO)); m_ResendTimer.async_wait (std::bind (&Stream::HandleResendTimer, shared_from_this (), std::placeholders::_1));