diff --git a/src/cpp/ripple/Peer.cpp b/src/cpp/ripple/Peer.cpp index 60aaa76b47..01c60394d0 100644 --- a/src/cpp/ripple/Peer.cpp +++ b/src/cpp/ripple/Peer.cpp @@ -363,28 +363,28 @@ void Peer::handleReadHeader(const boost::system::error_code& error) void Peer::handleReadBody(const boost::system::error_code& error) { - boost::recursive_mutex::scoped_lock sl(ioMutex); + { + boost::recursive_mutex::scoped_lock sl(ioMutex); - if (mDetaching) - { - // Drop data or error if detaching. - nothing(); - } - else if (!error) - { - processReadBuffer(); - startReadHeader(); - } - else - { - cLog(lsINFO) << "Peer: Body: Error: " << ADDRESS(this) << ": " << error.category().name() << ": " << error.message() << ": " << error; - boost::recursive_mutex::scoped_lock sl(theApp->getMasterLock()); - detach("hrb"); + if (mDetaching) + { + return; + } + else if (error) + { + cLog(lsINFO) << "Peer: Body: Error: " << ADDRESS(this) << ": " << error.category().name() << ": " << error.message() << ": " << error; + boost::recursive_mutex::scoped_lock sl(theApp->getMasterLock()); + detach("hrb"); + return; + } } + + processReadBuffer(); + startReadHeader(); } void Peer::processReadBuffer() -{ +{ // must not hold peer lock int type = PackedMessage::getType(mReadbuf); #ifdef DEBUG // std::cerr << "PRB(" << type << "), len=" << (mReadbuf.size()-HEADER_SIZE) << std::endl;