diff --git a/Builds/QtCreator/rippled.pro b/Builds/QtCreator/rippled.pro index 0cc5fdfc8b..9dac36d3c3 100644 --- a/Builds/QtCreator/rippled.pro +++ b/Builds/QtCreator/rippled.pro @@ -71,11 +71,13 @@ SOURCES += \ ../../modules/ripple_app/ripple_app_pt7.cpp \ ../../modules/ripple_app/ripple_app_pt8.cpp \ ../../modules/ripple_basics/ripple_basics.cpp \ + ../../modules/ripple_basio/ripple_basio.cpp \ ../../modules/ripple_core/ripple_core.cpp \ ../../modules/ripple_client/ripple_client.cpp \ ../../modules/ripple_data/ripple_data.cpp \ ../../modules/ripple_json/ripple_json.cpp \ ../../modules/ripple_leveldb/ripple_leveldb.cpp \ + ../../modules/ripple_net/ripple_net.cpp \ ../../modules/ripple_sqlite/ripple_sqlite.c \ ../../modules/ripple_websocket/ripple_websocket.cpp diff --git a/Builds/VisualStudio2012/RippleD.vcxproj b/Builds/VisualStudio2012/RippleD.vcxproj index 8f4d920169..61d1ed51b5 100644 --- a/Builds/VisualStudio2012/RippleD.vcxproj +++ b/Builds/VisualStudio2012/RippleD.vcxproj @@ -136,6 +136,13 @@ true true + + true + true + true + true + + true @@ -345,6 +352,13 @@ + + true + true + true + true + + true @@ -384,12 +398,6 @@ true true - - true - true - true - true - true true @@ -1336,6 +1344,10 @@ + + + + @@ -1378,6 +1390,8 @@ + + @@ -1385,7 +1399,6 @@ - @@ -1566,6 +1579,8 @@ + + diff --git a/Builds/VisualStudio2012/RippleD.vcxproj.filters b/Builds/VisualStudio2012/RippleD.vcxproj.filters index 37bdbd0b3c..dd0434c6bf 100644 --- a/Builds/VisualStudio2012/RippleD.vcxproj.filters +++ b/Builds/VisualStudio2012/RippleD.vcxproj.filters @@ -133,6 +133,24 @@ {e54bae0e-09f1-483e-bcf7-fb6b17b8d561} + + {c6a852db-1174-4bf6-a726-ebaabf595743} + + + {c977169f-d68b-4a59-aa0b-f7d49157d9ac} + + + {c84fc3af-f487-4eba-af78-d4be009f76d1} + + + {febf2e7e-f071-4a6c-9b81-68498fc8ea57} + + + {10893147-455d-4a9e-ad3b-ec12d296a03d} + + + {03c077b7-8ae4-4e00-9eb5-78295cfd377d} + @@ -654,9 +672,6 @@ [1] Ripple\ripple_app\_misc - - [1] Ripple\ripple_app\_network - [1] Ripple\ripple_app\_network @@ -717,9 +732,6 @@ [1] Ripple\ripple_app\_rpc - - [1] Ripple\ripple_app\_rpc - [1] Ripple\ripple_app\_rpc @@ -825,6 +837,21 @@ [1] Ripple\ripple_data\protocol + + [1] Ripple\ripple_basio + + + [1] Ripple\ripple_basio\boost + + + [1] Ripple\ripple_net + + + [1] Ripple\ripple_net\basics + + + [1] Ripple\ripple_app\_network + @@ -1374,9 +1401,6 @@ [1] Ripple\ripple_app\_misc - - [1] Ripple\ripple_app\_network - [1] Ripple\ripple_app\_network @@ -1449,9 +1473,6 @@ [1] Ripple\ripple_app\_rpc - - [1] Ripple\ripple_app\_rpc - [1] Ripple\ripple_app\_rpc @@ -1542,6 +1563,27 @@ [1] Ripple\ripple_data\protocol + + [1] Ripple\ripple_basio + + + [1] Ripple\ripple_basio + + + [1] Ripple\ripple_basio + + + [1] Ripple\ripple_basio\boost + + + [1] Ripple\ripple_net + + + [1] Ripple\ripple_net\basics + + + [1] Ripple\ripple_app\_network + @@ -1559,6 +1601,8 @@ + + diff --git a/SConstruct b/SConstruct index ce9fb2d7be..149ad38378 100644 --- a/SConstruct +++ b/SConstruct @@ -121,13 +121,6 @@ INCLUDE_PATHS = [ COMPILED_FILES = [ 'Subtrees/beast/modules/beast_core/beast_core.cpp', 'Subtrees/beast/modules/beast_basics/beast_basics.cpp', - 'modules/ripple_basics/ripple_basics.cpp', - 'modules/ripple_core/ripple_core.cpp', - 'modules/ripple_data/ripple_data.cpp', - 'modules/ripple_json/ripple_json.cpp', - 'modules/ripple_leveldb/ripple_leveldb.cpp', - 'modules/ripple_websocket/ripple_websocket.cpp', - 'modules/ripple_sqlite/ripple_sqlite.c', 'modules/ripple_app/ripple_app_pt1.cpp', 'modules/ripple_app/ripple_app_pt2.cpp', 'modules/ripple_app/ripple_app_pt3.cpp', @@ -135,7 +128,16 @@ COMPILED_FILES = [ 'modules/ripple_app/ripple_app_pt5.cpp', 'modules/ripple_app/ripple_app_pt6.cpp', 'modules/ripple_app/ripple_app_pt7.cpp', - 'modules/ripple_app/ripple_app_pt8.cpp' + 'modules/ripple_app/ripple_app_pt8.cpp', + 'modules/ripple_basics/ripple_basics.cpp', + 'modules/ripple_basio/ripple_basio.cpp', + 'modules/ripple_core/ripple_core.cpp', + 'modules/ripple_data/ripple_data.cpp', + 'modules/ripple_json/ripple_json.cpp', + 'modules/ripple_leveldb/ripple_leveldb.cpp', + 'modules/ripple_net/ripple_net.cpp', + 'modules/ripple_websocket/ripple_websocket.cpp', + 'modules/ripple_sqlite/ripple_sqlite.c' ] #------------------------------------------------------------------------------- diff --git a/modules/ripple_app/ripple_app.cpp b/modules/ripple_app/ripple_app.cpp index c4f34736fa..80f2b6165a 100644 --- a/modules/ripple_app/ripple_app.cpp +++ b/modules/ripple_app/ripple_app.cpp @@ -75,6 +75,8 @@ #include "../ripple_data/ripple_data.h" +#include "../ripple_net/ripple_net.h" + #include "../modules/ripple_websocket/ripple_websocket.h" //------------------------------------------------------------------------------ @@ -151,7 +153,6 @@ namespace ripple #include "src/cpp/ripple/CallRPC.h" #include "src/cpp/ripple/Transactor.h" #include "src/cpp/ripple/ChangeTransactor.h" -#include "src/cpp/ripple/HTTPRequest.h" #include "src/cpp/ripple/HttpsClient.h" #include "src/cpp/ripple/ripple_TransactionAcquire.h" #include "src/cpp/ripple/ripple_DisputedTx.h" @@ -260,7 +261,6 @@ static const uint64 tenTo17m1 = tenTo17 - 1; #include "src/cpp/ripple/AccountSetTransactor.cpp" #include "src/cpp/ripple/ripple_CanonicalTXSet.cpp" #include "src/cpp/ripple/Contract.cpp" -#include "src/cpp/ripple/HTTPRequest.cpp" #include "src/cpp/ripple/LedgerProposal.cpp" #include "src/cpp/ripple/ripple_LoadManager.cpp" #include "src/cpp/ripple/ripple_NicknameState.cpp" diff --git a/modules/ripple_app/ripple_app.h b/modules/ripple_app/ripple_app.h index 15e362a289..95f4794ace 100644 --- a/modules/ripple_app/ripple_app.h +++ b/modules/ripple_app/ripple_app.h @@ -17,9 +17,11 @@ @defgroup ripple_app */ -#ifndef RIPPLE_MAIN_H -#define RIPPLE_MAIN_H +#ifndef RIPPLE_APP_H_INCLUDED +#define RIPPLE_APP_H_INCLUDED #include "modules/ripple_basics/ripple_basics.h" +#include "modules/ripple_basio/ripple_basio.h" + #endif diff --git a/modules/ripple_basio/boost/ripple_IoService.cpp b/modules/ripple_basio/boost/ripple_IoService.cpp new file mode 100644 index 0000000000..ff71280882 --- /dev/null +++ b/modules/ripple_basio/boost/ripple_IoService.cpp @@ -0,0 +1,44 @@ +//------------------------------------------------------------------------------ +/* + Copyright (c) 2011-2013, OpenCoin, Inc. +*/ +//============================================================================== + +namespace basio +{ + +IoService* IoService::New (std::size_t concurrency_hint) +{ + return new IoService (concurrency_hint); +} + +IoService::~IoService () +{ +} + +IoService::operator boost::asio::io_service& () +{ + return *m_impl; +} + +IoService::IoService (std::size_t concurrency_hint) + : m_impl (new boost::asio::io_service (concurrency_hint)) +{ +} + +void IoService::stop () +{ + m_impl->stop (); +} + +bool IoService::stopped () +{ + return m_impl->stopped (); +} + +void IoService::run () +{ + m_impl->run (); +} + +} diff --git a/modules/ripple_basio/boost/ripple_IoService.h b/modules/ripple_basio/boost/ripple_IoService.h new file mode 100644 index 0000000000..6afe49384a --- /dev/null +++ b/modules/ripple_basio/boost/ripple_IoService.h @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +/* + Copyright (c) 2011-2013, OpenCoin, Inc. +*/ +//============================================================================== + +#ifndef RIPPLE_IOSERVICE_H_INCLUDED +#define RIPPLE_IOSERVICE_H_INCLUDED + +namespace basio +{ + +/** Hides a boost::asio::ioservice implementation. +*/ +class IoService +{ +public: + static IoService* New (std::size_t concurrency_hint); + + virtual ~IoService (); + + operator boost::asio::io_service& (); + + void stop (); + bool stopped (); + void run (); + +private: + explicit IoService (std::size_t concurrency_hint); + +private: + beast::ScopedPointer m_impl; +}; + +} + +#endif diff --git a/modules/ripple_basio/ripple_basio.cpp b/modules/ripple_basio/ripple_basio.cpp new file mode 100644 index 0000000000..ac0402bff7 --- /dev/null +++ b/modules/ripple_basio/ripple_basio.cpp @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +/* + Copyright (c) 2011-2013, OpenCoin, Inc. +*/ +//============================================================================== + +/** Add this to get the @ref ripple_basio module. + + @file ripple_basio.cpp + @ingroup ripple_basio +*/ + +//------------------------------------------------------------------------------ + +#include "BeastConfig.h" + +#include "ripple_basio.h" + +#include "ripple_basio_impl.h" + +namespace ripple +{ + +#include "boost/ripple_IoService.cpp" + +} diff --git a/modules/ripple_basio/ripple_basio.h b/modules/ripple_basio/ripple_basio.h new file mode 100644 index 0000000000..000a2e9cc0 --- /dev/null +++ b/modules/ripple_basio/ripple_basio.h @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +/* + Copyright (c) 2011-2013, OpenCoin, Inc. +*/ +//============================================================================== + +#ifndef RIPPLE_BASIO_H_INCLUDED +#define RIPPLE_BASIO_H_INCLUDED + +#include "beast/modules/beast_core/beast_core.h" + +// Must be outside the namespace + +#include "ripple_basio_fwdecl.h" + +/** Abstractions for boost::asio + + This is the first step to removing the dependency on boost::asio. + These classes are designed to move boost::asio header material out of + the majority of include paths. + + @ingroup ripple_basio + @file ripple_basio.h +*/ +namespace ripple +{ + +using namespace beast; + +#include "boost/ripple_IoService.h" + +} + +#endif diff --git a/modules/ripple_basio/ripple_basio_fwdecl.h b/modules/ripple_basio/ripple_basio_fwdecl.h new file mode 100644 index 0000000000..434cda02fc --- /dev/null +++ b/modules/ripple_basio/ripple_basio_fwdecl.h @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +/* + Copyright (c) 2011-2013, OpenCoin, Inc. +*/ +//============================================================================== + +#ifndef RIPPLE_BASIO_FWDECL_H_INCLUDED +#define RIPPLE_BASIO_FWDECL_H_INCLUDED + +/** Forward declarations for boost::asio. + + These allow the header material for boost::asio to be omitted for + most translation units. +*/ + +namespace boost { + +namespace asio { + +class io_service; + +} + +} + +#endif diff --git a/modules/ripple_basio/ripple_basio_impl.h b/modules/ripple_basio/ripple_basio_impl.h new file mode 100644 index 0000000000..362091ff13 --- /dev/null +++ b/modules/ripple_basio/ripple_basio_impl.h @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +/* + Copyright (c) 2011-2013, OpenCoin, Inc. +*/ +//============================================================================== + +#ifndef RIPPLE_BASIO_IMPL_H_INCLUDED +#define RIPPLE_BASIO_IMPL_H_INCLUDED + +// Once everything is converted, these can be moved to ripple_basio.cpp +#include + +/** Implementations for boost::asio abstractions. + + These require boost::asio header material to be included. +*/ + +namespace ripple +{ + +} + +#endif diff --git a/src/cpp/ripple/HTTPRequest.cpp b/modules/ripple_net/basics/ripple_HTTPRequest.cpp similarity index 95% rename from src/cpp/ripple/HTTPRequest.cpp rename to modules/ripple_net/basics/ripple_HTTPRequest.cpp index 15ec644b02..2c066c7991 100644 --- a/src/cpp/ripple/HTTPRequest.cpp +++ b/modules/ripple_net/basics/ripple_HTTPRequest.cpp @@ -18,7 +18,7 @@ void HTTPRequest::reset () eState = await_request; } -HTTPRequestAction HTTPRequest::requestDone (bool forceClose) +HTTPRequest::Action HTTPRequest::requestDone (bool forceClose) { if (forceClose || bShouldClose) return haCLOSE_CONN; @@ -35,7 +35,7 @@ std::string HTTPRequest::getReplyHeaders (bool forceClose) return "Connection: Keep-Alive\r\n"; } -HTTPRequestAction HTTPRequest::consume (boost::asio::streambuf& buf) +HTTPRequest::Action HTTPRequest::consume (boost::asio::streambuf& buf) { std::string line; std::istream is (&buf); diff --git a/src/cpp/ripple/HTTPRequest.h b/modules/ripple_net/basics/ripple_HTTPRequest.h similarity index 76% rename from src/cpp/ripple/HTTPRequest.h rename to modules/ripple_net/basics/ripple_HTTPRequest.h index 9219eba3ab..b272cc24b9 100644 --- a/src/cpp/ripple/HTTPRequest.h +++ b/modules/ripple_net/basics/ripple_HTTPRequest.h @@ -4,23 +4,23 @@ */ //============================================================================== -#ifndef HTTPREQUEST__HPP -#define HTTPREQUEST__HPP - -enum HTTPRequestAction -{ - // What the application code needs to do - haERROR = 0, - haREAD_LINE = 1, - haREAD_RAW = 2, - haDO_REQUEST = 3, - haCLOSE_CONN = 4 -}; +#ifndef RIPPLE_HTTPREQUEST_H_INCLUDED +#define RIPPLE_HTTPREQUEST_H_INCLUDED +/** An HTTP request we are handling from a client. +*/ class HTTPRequest { - // an HTTP request we are handling from a client public: + enum Action + { + // What the application code needs to do + haERROR = 0, + haREAD_LINE = 1, + haREAD_RAW = 2, + haDO_REQUEST = 3, + haCLOSE_CONN = 4 + }; HTTPRequest () : eState (await_request), iDataSize (0), bShouldClose (true) { @@ -59,8 +59,8 @@ public: } std::string getReplyHeaders (bool forceClose); - HTTPRequestAction consume (boost::asio::streambuf&); - HTTPRequestAction requestDone (bool forceClose); // call after reply is sent + Action consume (boost::asio::streambuf&); + Action requestDone (bool forceClose); // call after reply is sent int getDataSize () { diff --git a/modules/ripple_net/ripple_net.cpp b/modules/ripple_net/ripple_net.cpp new file mode 100644 index 0000000000..64fa6c7d7b --- /dev/null +++ b/modules/ripple_net/ripple_net.cpp @@ -0,0 +1,22 @@ +//------------------------------------------------------------------------------ +/* + Copyright (c) 2011-2013, OpenCoin, Inc. +*/ +//============================================================================== + +/** Add this to get the @ref ripple_net module. + + @file ripple_net.cpp + @ingroup ripple_net +*/ + +#include "BeastConfig.h" + +#include "ripple_net.h" + +namespace ripple +{ + +#include "basics/ripple_HTTPRequest.cpp" + +} diff --git a/modules/ripple_net/ripple_net.h b/modules/ripple_net/ripple_net.h new file mode 100644 index 0000000000..38dd906d33 --- /dev/null +++ b/modules/ripple_net/ripple_net.h @@ -0,0 +1,32 @@ +//------------------------------------------------------------------------------ +/* + Copyright (c) 2011-2013, OpenCoin, Inc. +*/ +//============================================================================== + +#ifndef RIPPLE_NET_H_INCLUDED +#define RIPPLE_NET_H_INCLUDED + +/** Include this to get the @ref ripple_net module. + + @file ripple_net.h + @ingroup ripple_net +*/ + +/** Network classes. + + This module provides classes that handle all network activities. + + @defgroup ripple_net +*/ + +#include "../ripple_basics/ripple_basics.h" + +namespace ripple +{ + +#include "basics/ripple_HTTPRequest.h" + +} + +#endif diff --git a/modules/ripple_websocket/autosocket/ripple_AutoSocket.h b/modules/ripple_websocket/autosocket/ripple_AutoSocket.h index d8b931b16d..a64b326c6e 100644 --- a/modules/ripple_websocket/autosocket/ripple_AutoSocket.h +++ b/modules/ripple_websocket/autosocket/ripple_AutoSocket.h @@ -7,9 +7,6 @@ #ifndef __AUTOSOCKET_H_ #define __AUTOSOCKET_H_ -namespace basio = boost::asio; -namespace bassl = basio::ssl; - // Socket wrapper that supports both SSL and non-SSL connections. // Generally, handle it as you would an SSL connection. // To force a non-SSL connection, just don't call async_handshake. @@ -18,7 +15,7 @@ namespace bassl = basio::ssl; class AutoSocket { public: - typedef bassl::stream ssl_socket; + typedef boost::asio::ssl::stream ssl_socket; typedef boost::shared_ptr socket_ptr; typedef ssl_socket::next_layer_type plain_socket; typedef ssl_socket::lowest_layer_type lowest_layer_type; @@ -27,12 +24,12 @@ public: typedef boost::function callback; public: - AutoSocket (basio::io_service& s, bassl::context& c) : mSecure (false), mBuffer (4) + AutoSocket (boost::asio::io_service& s, boost::asio::ssl::context& c) : mSecure (false), mBuffer (4) { mSocket = boost::make_shared (boost::ref (s), boost::ref (c)); } - AutoSocket (basio::io_service& s, bassl::context& c, bool secureOnly, bool plainOnly) + AutoSocket (boost::asio::io_service& s, boost::asio::ssl::context& c, bool secureOnly, bool plainOnly) : mSecure (secureOnly), mBuffer ((plainOnly || secureOnly) ? 0 : 4) { mSocket = boost::make_shared (boost::ref (s), boost::ref (c)); @@ -112,9 +109,9 @@ public: else { // autodetect - mSocket->next_layer ().async_receive (basio::buffer (mBuffer), basio::socket_base::message_peek, + mSocket->next_layer ().async_receive (boost::asio::buffer (mBuffer), boost::asio::socket_base::message_peek, boost::bind (&AutoSocket::handle_autodetect, this, cbFunc, - basio::placeholders::error, basio::placeholders::bytes_transferred)); + boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)); } } @@ -151,27 +148,27 @@ public: void async_read_until (const Seq& buffers, Condition condition, Handler handler) { if (isSecure ()) - basio::async_read_until (*mSocket, buffers, condition, handler); + boost::asio::async_read_until (*mSocket, buffers, condition, handler); else - basio::async_read_until (PlainSocket (), buffers, condition, handler); + boost::asio::async_read_until (PlainSocket (), buffers, condition, handler); } template - void async_read_until (basio::basic_streambuf& buffers, const std::string& delim, Handler handler) + void async_read_until (boost::asio::basic_streambuf& buffers, const std::string& delim, Handler handler) { if (isSecure ()) - basio::async_read_until (*mSocket, buffers, delim, handler); + boost::asio::async_read_until (*mSocket, buffers, delim, handler); else - basio::async_read_until (PlainSocket (), buffers, delim, handler); + boost::asio::async_read_until (PlainSocket (), buffers, delim, handler); } template - void async_read_until (basio::basic_streambuf& buffers, MatchCondition cond, Handler handler) + void async_read_until (boost::asio::basic_streambuf& buffers, MatchCondition cond, Handler handler) { if (isSecure ()) - basio::async_read_until (*mSocket, buffers, cond, handler); + boost::asio::async_read_until (*mSocket, buffers, cond, handler); else - basio::async_read_until (PlainSocket (), buffers, cond, handler); + boost::asio::async_read_until (PlainSocket (), buffers, cond, handler); } template @@ -202,7 +199,7 @@ public: } template - void async_read (basio::basic_streambuf& buffers, Condition cond, Handler handler) + void async_read (boost::asio::basic_streambuf& buffers, Condition cond, Handler handler) { if (isSecure ()) boost::asio::async_read (*mSocket, buffers, cond, handler); diff --git a/src/cpp/ripple/NetworkOPs.cpp b/src/cpp/ripple/NetworkOPs.cpp index 3cb72514f8..ca67723927 100644 --- a/src/cpp/ripple/NetworkOPs.cpp +++ b/src/cpp/ripple/NetworkOPs.cpp @@ -18,13 +18,25 @@ SETUP_LOG (NetworkOPs) // code assumes this node is synched (and will continue to do so until // there's a functional network. -NetworkOPs::NetworkOPs (boost::asio::io_service& io_service, LedgerMaster* pLedgerMaster) : - mMode (omDISCONNECTED), mNeedNetworkLedger (false), mProposing (false), mValidating (false), - mFeatureBlocked (false), - mNetTimer (io_service), mLedgerMaster (pLedgerMaster), mCloseTimeOffset (0), mLastCloseProposers (0), - mLastCloseConvergeTime (1000 * LEDGER_IDLE_INTERVAL), mLastCloseTime (0), mLastValidationTime (0), - mFetchPack ("FetchPack", 2048, 20), mLastFetchPack (0), mFetchSeq (static_cast (-1)), - mLastLoadBase (256), mLastLoadFactor (256) +NetworkOPs::NetworkOPs (boost::asio::io_service& io_service, LedgerMaster* pLedgerMaster) + : mMode (omDISCONNECTED) + , mNeedNetworkLedger (false) + , mProposing (false) + , mValidating (false) + , mFeatureBlocked (false) + , mNetTimer (io_service) + , mLedgerMaster (pLedgerMaster) + , mCloseTimeOffset (0) + , mLastCloseProposers (0) + , mLastCloseConvergeTime (1000 * LEDGER_IDLE_INTERVAL) + , mLastCloseTime (0) + , mLastValidationTime (0) + , mFetchPack ("FetchPack", 2048, 20) + , mLastFetchPack (0) + // VFALCO TODO Give this magic number a name + , mFetchSeq (static_cast (-1)) + , mLastLoadBase (256) + , mLastLoadFactor (256) { } @@ -2278,11 +2290,18 @@ bool NetworkOPs::shouldFetchPack (uint32 seq) int size = mFetchPack.getCacheSize (); if (size == 0) + { + // VFALCO TODO Give this magic number a name + // mFetchSeq = static_cast (-1); + } else if (mFetchPack.getCacheSize () > 64) + { return false; + } mLastFetchPack = now; + return true; } diff --git a/src/cpp/ripple/NetworkOPs.h b/src/cpp/ripple/NetworkOPs.h index 75ad54b9a6..f4b4f4e3b6 100644 --- a/src/cpp/ripple/NetworkOPs.h +++ b/src/cpp/ripple/NetworkOPs.h @@ -397,6 +397,11 @@ private: TaggedCache< uint256, Blob , UptimeTimerAdapter > mFetchPack; uint32 mLastFetchPack; + + // VFALCO TODO Document the special value uint32(-1) for this member + // and replace uint32(-1) with a constant. It is initialized + // in the ctor-initializer list to this constant. + // uint32 mFetchSeq; uint32 mLastLoadBase; diff --git a/src/cpp/ripple/RPCServer.cpp b/src/cpp/ripple/RPCServer.cpp index 1bbc88cec4..1113e87131 100644 --- a/src/cpp/ripple/RPCServer.cpp +++ b/src/cpp/ripple/RPCServer.cpp @@ -49,22 +49,22 @@ void RPCServer::handle_read_line (const boost::system::error_code& e) if (e) return; - HTTPRequestAction action = mHTTPRequest.consume (mLineBuffer); + HTTPRequest::Action action = mHTTPRequest.consume (mLineBuffer); - if (action == haDO_REQUEST) + if (action == HTTPRequest::haDO_REQUEST) { // request with no body WriteLog (lsWARNING, RPCServer) << "RPC HTTP request with no body"; mSocket.async_shutdown (mStrand.wrap (boost::bind (&RPCServer::handle_shutdown, shared_from_this(), boost::asio::placeholders::error))); return; } - else if (action == haREAD_LINE) + else if (action == HTTPRequest::haREAD_LINE) { boost::asio::async_read_until (mSocket, mLineBuffer, "\r\n", mStrand.wrap (boost::bind (&RPCServer::handle_read_line, shared_from_this (), boost::asio::placeholders::error))); } - else if (action == haREAD_RAW) + else if (action == HTTPRequest::haREAD_RAW) { int rLen = mHTTPRequest.getDataSize (); @@ -182,9 +182,9 @@ void RPCServer::handle_write (const boost::system::error_code& e) if (!e) { - HTTPRequestAction action = mHTTPRequest.requestDone (false); + HTTPRequest::Action action = mHTTPRequest.requestDone (false); - if (action == haCLOSE_CONN) + if (action == HTTPRequest::haCLOSE_CONN) mSocket.async_shutdown (mStrand.wrap (boost::bind (&RPCServer::handle_shutdown, shared_from_this(), boost::asio::placeholders::error))); else { diff --git a/src/cpp/ripple/ripple_Application.cpp b/src/cpp/ripple/ripple_Application.cpp index 5930d8a720..ae1d932d3a 100644 --- a/src/cpp/ripple/ripple_Application.cpp +++ b/src/cpp/ripple/ripple_Application.cpp @@ -208,6 +208,10 @@ private: private: boost::asio::io_service mIOService; boost::asio::io_service mAuxService; + // The lifetime of the io_service::work object informs the io_service + // of when the work starts and finishes. io_service::run() will not exit + // while the work object exists. + // boost::asio::io_service::work mIOWork; boost::recursive_mutex mMasterLock;