From 6ccef669203707e0b22544cf1e6a04490cf73230 Mon Sep 17 00:00:00 2001 From: orignal Date: Wed, 26 Jun 2019 10:47:16 -0400 Subject: [PATCH] call shutdown before close --- libi2pd/NTCP2.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libi2pd/NTCP2.cpp b/libi2pd/NTCP2.cpp index 5b5073f9..368f1b3e 100644 --- a/libi2pd/NTCP2.cpp +++ b/libi2pd/NTCP2.cpp @@ -396,6 +396,10 @@ namespace transport { m_IsTerminated = true; m_IsEstablished = false; + boost::system::error_code ec; + m_Socket.shutdown(boost::asio::ip::tcp::socket::shutdown_both, ec); + if (ec) + LogPrint (eLogDebug, "NTCP2: Couldn't shutdown socket: ", ec.message ()); m_Socket.close (); transports.PeerDisconnected (shared_from_this ()); m_Server.RemoveNTCP2Session (shared_from_this ());