Fix PeerImp concurrent access of socket:

The PeerImp::run launch function is now dispatched on the strand to prevent
undefined behavior resulting from concurrent access to the ssl::stream object.
This commit is contained in:
Vinnie Falco
2015-01-21 14:10:22 -08:00
parent 6ef9a81017
commit 4144f800a1

View File

@@ -92,6 +92,9 @@ PeerImp::~PeerImp ()
void void
PeerImp::run() PeerImp::run()
{ {
if(! strand_.running_in_this_thread())
return strand_.post(std::bind (
&PeerImp::run, shared_from_this()));
if (m_inbound) if (m_inbound)
{ {
if (read_buffer_.size() > 0) if (read_buffer_.size() > 0)