mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-03 08:46:46 +00:00
correctly handle shutdown when tls was not established yet
This commit is contained in:
@@ -136,14 +136,16 @@ ConnectAttempt::tryAsyncShutdown()
|
||||
return;
|
||||
|
||||
shutdownStarted_ = true;
|
||||
|
||||
// gracefully shutdown the SSL socket, performing a shutdown handshake
|
||||
stream_.async_shutdown(bind_executor(
|
||||
strand_,
|
||||
std::bind(
|
||||
&ConnectAttempt::onShutdown,
|
||||
shared_from_this(),
|
||||
std::placeholders::_1)));
|
||||
if (handshakeComplete_)
|
||||
return stream_.async_shutdown(bind_executor(
|
||||
strand_,
|
||||
std::bind(
|
||||
&ConnectAttempt::onShutdown,
|
||||
shared_from_this(),
|
||||
std::placeholders::_1)));
|
||||
|
||||
close();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -306,6 +308,8 @@ ConnectAttempt::onHandshake(error_code ec)
|
||||
if (ec)
|
||||
return fail("onHandshake", ec);
|
||||
|
||||
handshakeComplete_ = true;
|
||||
|
||||
// check if we connected to ourselves
|
||||
if (!overlay_.peerFinder().onConnected(
|
||||
slot_, beast::IPAddressConversion::from_asio(local_endpoint)))
|
||||
@@ -349,8 +353,6 @@ ConnectAttempt::onHandshake(error_code ec)
|
||||
void
|
||||
ConnectAttempt::onWrite(error_code ec)
|
||||
{
|
||||
cancelTimer();
|
||||
|
||||
ioPending_ = false;
|
||||
|
||||
if (ec)
|
||||
|
||||
@@ -65,6 +65,7 @@ private:
|
||||
bool shutdown_ = false;
|
||||
bool ioPending_ = false;
|
||||
bool shutdownStarted_ = false;
|
||||
bool handshakeComplete_ = false;
|
||||
|
||||
public:
|
||||
ConnectAttempt(
|
||||
|
||||
Reference in New Issue
Block a user