mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Refactor Application shutdown using new Service, AsyncService interfaces
This commit is contained in:
@@ -28,7 +28,8 @@ public:
|
||||
WSDoorImp (InfoSub::Source& source,
|
||||
std::string const& strIp, int iPort, bool bPublic,
|
||||
boost::asio::ssl::context& ssl_context)
|
||||
: Thread ("websocket")
|
||||
: WSDoor (source)
|
||||
, Thread ("websocket")
|
||||
, m_source (source)
|
||||
, m_ssl_context (ssl_context)
|
||||
, m_endpointLock (this, "WSDoor", __FILE__, __LINE__)
|
||||
@@ -41,15 +42,7 @@ public:
|
||||
|
||||
~WSDoorImp ()
|
||||
{
|
||||
{
|
||||
ScopedLockType lock (m_endpointLock, __FILE__, __LINE__);
|
||||
|
||||
if (m_endpoint != nullptr)
|
||||
m_endpoint->stop ();
|
||||
}
|
||||
|
||||
signalThreadShouldExit ();
|
||||
waitForThreadToExit ();
|
||||
stopThread ();
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -101,6 +94,23 @@ private:
|
||||
|
||||
m_endpoint = nullptr;
|
||||
}
|
||||
|
||||
serviceStopped ();
|
||||
}
|
||||
|
||||
void onServiceStop ()
|
||||
{
|
||||
{
|
||||
ScopedLockType lock (m_endpointLock, __FILE__, __LINE__);
|
||||
|
||||
// VFALCO NOTE we probably dont want to block here
|
||||
// but websocketpp is deficient and broken.
|
||||
//
|
||||
if (m_endpoint != nullptr)
|
||||
m_endpoint->stop ();
|
||||
}
|
||||
|
||||
signalThreadShouldExit ();
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -119,6 +129,13 @@ private:
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
WSDoor::WSDoor (Service& parent)
|
||||
: Service ("WSDoor", parent)
|
||||
{
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
WSDoor* WSDoor::New (InfoSub::Source& source, std::string const& strIp,
|
||||
int iPort, bool bPublic, boost::asio::ssl::context& ssl_context)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user