From c88638afe42d2152bc6279087f1722d3413b395b Mon Sep 17 00:00:00 2001 From: orignal Date: Tue, 8 Nov 2022 10:37:34 -0500 Subject: [PATCH] reconnect to proxy if receive error --- libi2pd/SSU2.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/libi2pd/SSU2.cpp b/libi2pd/SSU2.cpp index fdb4f1ad..65f6f4f1 100644 --- a/libi2pd/SSU2.cpp +++ b/libi2pd/SSU2.cpp @@ -277,10 +277,20 @@ namespace transport if (ecode != boost::asio::error::operation_aborted) { LogPrint (eLogError, "SSU2: Receive error: code ", ecode.value(), ": ", ecode.message ()); - auto ep = socket.local_endpoint (); - socket.close (); - OpenSocket (ep); - Receive (socket); + if (m_IsThroughProxy) + { + m_UDPAssociateSocket.reset (nullptr); + m_ProxyRelayEndpoint.reset (nullptr); + m_SocketV4.close (); + ConnectToProxy (); + } + else + { + auto ep = socket.local_endpoint (); + socket.close (); + OpenSocket (ep); + Receive (socket); + } } } }