diff --git a/src/cpp/ripple/NetworkOPs.h b/src/cpp/ripple/NetworkOPs.h index 41515b003a..0997f42af8 100644 --- a/src/cpp/ripple/NetworkOPs.h +++ b/src/cpp/ripple/NetworkOPs.h @@ -33,11 +33,14 @@ protected: boost::unordered_set mSubAccountInfo; boost::unordered_set mSubAccountTransaction; + boost::mutex mLock; + public: - void insertSubAccountInfo(RippleAddress addr) - { - mSubAccountInfo.insert(addr); - } + void insertSubAccountInfo(RippleAddress addr) + { + boost::mutex::scoped_lock sl(mLock); + mSubAccountInfo.insert(addr); + } }; class NetworkOPs diff --git a/src/cpp/ripple/RPCHandler.cpp b/src/cpp/ripple/RPCHandler.cpp index 9d9d1544e7..dbe8e824e7 100644 --- a/src/cpp/ripple/RPCHandler.cpp +++ b/src/cpp/ripple/RPCHandler.cpp @@ -2023,8 +2023,6 @@ Json::Value RPCHandler::doSubscribe(const Json::Value& jvRequest) jvResult["error"] = "malformedAccount"; }else { - boost::mutex::scoped_lock sl(mLock); - BOOST_FOREACH(const RippleAddress& naAccountID, usnaAccoundIds) { isCurrent->insertSubAccountInfo(naAccountID); @@ -2043,8 +2041,6 @@ Json::Value RPCHandler::doSubscribe(const Json::Value& jvRequest) jvResult["error"] = "malformedAccount"; }else { - boost::mutex::scoped_lock sl(mLock); - BOOST_FOREACH(const RippleAddress& naAccountID, usnaAccoundIds) { isCurrent->insertSubAccountInfo(naAccountID); @@ -2101,8 +2097,6 @@ Json::Value RPCHandler::doUnsubscribe(const Json::Value& jvRequest) jvResult["error"] = "malformedAccount"; }else { - boost::mutex::scoped_lock sl(mLock); - BOOST_FOREACH(const RippleAddress& naAccountID, usnaAccoundIds) { isCurrent->insertSubAccountInfo(naAccountID); @@ -2121,8 +2115,6 @@ Json::Value RPCHandler::doUnsubscribe(const Json::Value& jvRequest) jvResult["error"] = "malformedAccount"; }else { - boost::mutex::scoped_lock sl(mLock); - BOOST_FOREACH(const RippleAddress& naAccountID, usnaAccoundIds) { isCurrent->insertSubAccountInfo(naAccountID); diff --git a/src/cpp/ripple/RPCHandler.h b/src/cpp/ripple/RPCHandler.h index 90cc0132aa..7e804d1979 100644 --- a/src/cpp/ripple/RPCHandler.h +++ b/src/cpp/ripple/RPCHandler.h @@ -8,7 +8,6 @@ class RPCHandler { NetworkOPs* mNetOps; InfoSub* isCurrent; - boost::mutex mLock; typedef Json::Value (RPCHandler::*doFuncPtr)(const Json::Value ¶ms); enum {