From 4144f800a1120c22783091e3d80151d574a1846c Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Wed, 21 Jan 2015 14:10:22 -0800 Subject: [PATCH] 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. --- src/ripple/overlay/impl/PeerImp.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ripple/overlay/impl/PeerImp.cpp b/src/ripple/overlay/impl/PeerImp.cpp index e30ca3b93..754227ff1 100644 --- a/src/ripple/overlay/impl/PeerImp.cpp +++ b/src/ripple/overlay/impl/PeerImp.cpp @@ -92,6 +92,9 @@ PeerImp::~PeerImp () void PeerImp::run() { + if(! strand_.running_in_this_thread()) + return strand_.post(std::bind ( + &PeerImp::run, shared_from_this())); if (m_inbound) { if (read_buffer_.size() > 0)