mirror of
https://github.com/boostorg/beast.git
synced 2025-07-31 05:17:26 +02:00
Send from the strand
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
Version 207
|
||||||
|
|
||||||
|
* Send from the strand
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
Version 206
|
Version 206
|
||||||
|
|
||||||
* Clear error codes idiomatically
|
* Clear error codes idiomatically
|
||||||
|
@ -90,6 +90,17 @@ void
|
|||||||
websocket_session::
|
websocket_session::
|
||||||
send(boost::shared_ptr<std::string const> const& ss)
|
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
|
// Always add to queue
|
||||||
queue_.push_back(ss);
|
queue_.push_back(ss);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user