Send from the strand

This commit is contained in:
Vinnie Falco committed 2019-01-21 16:07:00 -08:00
1 parent 2dcb11b89a
commit 383b9cb7f2
2 files changed
+17

No files matched your search

@@ -90,6 +90,17 @@ void
websocket_session::
send(boost::shared_ptr<std::string const> const& ss)
{
// Get on the strand if we aren't already,
// otherwise we will concurrently access
// objects which are not thread-safe.
if(! strand_.running_in_this_thread())
return net::post(
net::bind_executor(strand_,
std::bind(
&websocket_session::send,
shared_from_this(),
ss)));
// Always add to queue
queue_.push_back(ss);