Refactor InfoSub to remove NetworkOPs dependency

This commit is contained in:
Vinnie Falco
2013-09-01 09:34:03 -07:00
parent 01fda4c30e
commit 35598d7933
11 changed files with 125 additions and 48 deletions

View File

@@ -3233,8 +3233,9 @@ Json::Value RPCHandler::doSubscribe (Json::Value params, LoadType* loadType, App
{
WriteLog (lsDEBUG, RPCHandler) << boost::str (boost::format ("doSubscribe: building: %s") % strUrl);
RPCSub::pointer rspSub = boost::make_shared<RPCSub> (getApp ().getIOService (),
getApp ().getJobQueue (), strUrl, strUsername, strPassword);
RPCSub::pointer rspSub = boost::make_shared <RPCSub> (
getApp ().getOPs (), getApp ().getIOService (),
getApp ().getJobQueue (), strUrl, strUsername, strPassword);
ispSub = mNetOps->addRpcSub (strUrl, boost::dynamic_pointer_cast<InfoSub> (rspSub));
}
else

View File

@@ -6,9 +6,11 @@
SETUP_LOG (RPCSub)
RPCSub::RPCSub (boost::asio::io_service& io_service, JobQueue& jobQueue,
const std::string& strUrl, const std::string& strUsername, const std::string& strPassword)
: m_io_service (io_service)
RPCSub::RPCSub (InfoSub::Source& source, boost::asio::io_service& io_service,
JobQueue& jobQueue, const std::string& strUrl, const std::string& strUsername,
const std::string& strPassword)
: InfoSub (source)
, m_io_service (io_service)
, m_jobQueue (jobQueue)
, mUrl (strUrl)
, mSSL (false)

View File

@@ -4,28 +4,28 @@
*/
//==============================================================================
#ifndef __RPCSUB__
#define __RPCSUB__
#ifndef RIPPLE_RPCSUB_H_INCLUDED
#define RIPPLE_RPCSUB_H_INCLUDED
// VFALCO TODO replace this macro with a language constant
#define RPC_EVENT_QUEUE_MAX 32
// Subscription object for JSON-RPC
// VFALCO TODO Move the implementation into the .cpp
//
class RPCSub
: public InfoSub
, LeakChecked <RPCSub>
, public LeakChecked <RPCSub>
{
public:
typedef boost::shared_ptr<RPCSub> pointer;
typedef const pointer& ref;
RPCSub (boost::asio::io_service& io_service,
RPCSub (InfoSub::Source& source, boost::asio::io_service& io_service,
JobQueue& jobQueue, const std::string& strUrl,
const std::string& strUsername, const std::string& strPassword);
virtual ~RPCSub ()
{
;
}
virtual ~RPCSub () { }
// Implement overridden functions from base class:
void send (const Json::Value& jvObj, bool broadcast);
@@ -67,4 +67,3 @@ private:
};
#endif
// vim:ts=4