mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-27 22:45:52 +00:00
A surprisingly simple fix to the InfoSub/websocketpp deadlock.
This commit is contained in:
@@ -54,8 +54,17 @@ public:
|
|||||||
mPingTimer(theApp->getAuxService()), mPinged(false)
|
mPingTimer(theApp->getAuxService()), mPinged(false)
|
||||||
{ setPingTimer(); }
|
{ setPingTimer(); }
|
||||||
|
|
||||||
|
void preDestroy()
|
||||||
|
{ // sever connection
|
||||||
|
mConnection.reset();
|
||||||
|
}
|
||||||
|
|
||||||
virtual ~WSConnection() { ; }
|
virtual ~WSConnection() { ; }
|
||||||
|
|
||||||
|
static void destroy(boost::shared_ptr< WSConnection<endpoint_type> >)
|
||||||
|
{ // Just discards the reference
|
||||||
|
}
|
||||||
|
|
||||||
// Implement overridden functions from base class:
|
// Implement overridden functions from base class:
|
||||||
void send(const Json::Value& jvObj)
|
void send(const Json::Value& jvObj)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -153,6 +153,10 @@ public:
|
|||||||
ptr = it->second; // prevent the WSConnection from being destroyed until we release the lock
|
ptr = it->second; // prevent the WSConnection from being destroyed until we release the lock
|
||||||
mMap.erase(it);
|
mMap.erase(it);
|
||||||
}
|
}
|
||||||
|
ptr->preDestroy(); // Must be done before we return
|
||||||
|
|
||||||
|
// Must be done without holding the websocket send lock
|
||||||
|
theApp->getAuxService().post(boost::bind(&WSConnection<endpoint_type>::destroy, ptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_message(connection_ptr cpClient, message_ptr mpMessage)
|
void on_message(connection_ptr cpClient, message_ptr mpMessage)
|
||||||
|
|||||||
Reference in New Issue
Block a user