mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Do not close socket on a foreign thread:
* Closing a socket in WSClient's cleanup method was not thread safe. Force the close to happen on the WSClient's strand.
This commit is contained in:
@@ -114,10 +114,12 @@ class WSClientImpl : public WSClient
|
||||
|
||||
void cleanup()
|
||||
{
|
||||
error_code ec;
|
||||
if(!peerClosed_)
|
||||
ws_.close({}, ec);
|
||||
stream_.close(ec);
|
||||
ios_.post(strand_.wrap([this] {
|
||||
error_code ec;
|
||||
if (!peerClosed_)
|
||||
ws_.close({}, ec);
|
||||
stream_.close(ec);
|
||||
}));
|
||||
work_ = boost::none;
|
||||
thread_.join();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user