mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-21 03:26:01 +00:00
Add module ripple_basio and ripple_net
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -136,6 +136,13 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\modules\ripple_basio\boost\ripple_IoService.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\modules\ripple_basio\ripple_basio.cpp" />
|
||||
<ClCompile Include="..\..\modules\ripple_client\ripple_client.cpp" />
|
||||
<ClCompile Include="..\..\modules\ripple_core\functional\ripple_Config.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
@@ -345,6 +352,13 @@
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\modules\ripple_json\ripple_json.cpp" />
|
||||
<ClCompile Include="..\..\modules\ripple_leveldb\ripple_leveldb.cpp" />
|
||||
<ClCompile Include="..\..\modules\ripple_net\basics\ripple_HTTPRequest.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\modules\ripple_net\ripple_net.cpp" />
|
||||
<ClCompile Include="..\..\modules\ripple_sqlite\ripple_sqlite.c" />
|
||||
<ClCompile Include="..\..\modules\ripple_websocket\autosocket\ripple_AutoSocket.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
@@ -384,12 +398,6 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\cpp\ripple\HTTPRequest.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\cpp\ripple\HttpsClient.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
@@ -1336,6 +1344,10 @@
|
||||
<ClInclude Include="..\..\modules\ripple_basics\utility\ripple_ThreadName.h" />
|
||||
<ClInclude Include="..\..\modules\ripple_basics\utility\ripple_Time.h" />
|
||||
<ClInclude Include="..\..\modules\ripple_basics\utility\ripple_UptimeTimer.h" />
|
||||
<ClInclude Include="..\..\modules\ripple_basio\boost\ripple_IoService.h" />
|
||||
<ClInclude Include="..\..\modules\ripple_basio\ripple_basio.h" />
|
||||
<ClInclude Include="..\..\modules\ripple_basio\ripple_basio_fwdecl.h" />
|
||||
<ClInclude Include="..\..\modules\ripple_basio\ripple_basio_impl.h" />
|
||||
<ClInclude Include="..\..\modules\ripple_client\ripple_client.h" />
|
||||
<ClInclude Include="..\..\modules\ripple_core\functional\ripple_Config.h" />
|
||||
<ClInclude Include="..\..\modules\ripple_core\functional\ripple_ILoadFeeTrack.h" />
|
||||
@@ -1378,6 +1390,8 @@
|
||||
<ClInclude Include="..\..\modules\ripple_json\json\json_writer.h" />
|
||||
<ClInclude Include="..\..\modules\ripple_json\ripple_json.h" />
|
||||
<ClInclude Include="..\..\modules\ripple_leveldb\ripple_leveldb.h" />
|
||||
<ClInclude Include="..\..\modules\ripple_net\basics\ripple_HTTPRequest.h" />
|
||||
<ClInclude Include="..\..\modules\ripple_net\ripple_net.h" />
|
||||
<ClInclude Include="..\..\modules\ripple_sqlite\ripple_sqlite.h" />
|
||||
<ClInclude Include="..\..\modules\ripple_websocket\autosocket\ripple_AutoSocket.h" />
|
||||
<ClInclude Include="..\..\modules\ripple_websocket\ripple_websocket.h" />
|
||||
@@ -1385,7 +1399,6 @@
|
||||
<ClInclude Include="..\..\src\cpp\ripple\CallRPC.h" />
|
||||
<ClInclude Include="..\..\src\cpp\ripple\ChangeTransactor.h" />
|
||||
<ClInclude Include="..\..\src\cpp\ripple\Contract.h" />
|
||||
<ClInclude Include="..\..\src\cpp\ripple\HTTPRequest.h" />
|
||||
<ClInclude Include="..\..\src\cpp\ripple\HttpsClient.h" />
|
||||
<ClInclude Include="..\..\src\cpp\ripple\Interpreter.h" />
|
||||
<ClInclude Include="..\..\src\cpp\ripple\Ledger.h" />
|
||||
@@ -1566,6 +1579,8 @@
|
||||
<None Include="..\..\modules\ripple_json\json\json_internalarray.inl" />
|
||||
<None Include="..\..\modules\ripple_json\json\json_internalmap.inl" />
|
||||
<None Include="..\..\modules\ripple_json\json\json_valueiterator.inl" />
|
||||
<None Include="..\..\SConstruct" />
|
||||
<None Include="..\QtCreator\rippled.pro" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="..\..\TODO.txt" />
|
||||
|
||||
@@ -133,6 +133,24 @@
|
||||
<Filter Include="[1] Ripple\ripple_app\_shamap">
|
||||
<UniqueIdentifier>{e54bae0e-09f1-483e-bcf7-fb6b17b8d561}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="[1] Ripple\ripple_basio">
|
||||
<UniqueIdentifier>{c6a852db-1174-4bf6-a726-ebaabf595743}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="[1] Ripple\ripple_basio\boost">
|
||||
<UniqueIdentifier>{c977169f-d68b-4a59-aa0b-f7d49157d9ac}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="[1] Ripple\ripple_net">
|
||||
<UniqueIdentifier>{c84fc3af-f487-4eba-af78-d4be009f76d1}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="[1] Ripple\ripple_net\basics">
|
||||
<UniqueIdentifier>{febf2e7e-f071-4a6c-9b81-68498fc8ea57}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="[1] Ripple\ripple_net\client">
|
||||
<UniqueIdentifier>{10893147-455d-4a9e-ad3b-ec12d296a03d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="[1] Ripple\ripple_net\peer">
|
||||
<UniqueIdentifier>{03c077b7-8ae4-4e00-9eb5-78295cfd377d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\Subtrees\sqlite\sqlite3.c">
|
||||
@@ -654,9 +672,6 @@
|
||||
<ClCompile Include="..\..\src\cpp\ripple\ripple_Validations.cpp">
|
||||
<Filter>[1] Ripple\ripple_app\_misc</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\cpp\ripple\HTTPRequest.cpp">
|
||||
<Filter>[1] Ripple\ripple_app\_network</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\cpp\ripple\HttpsClient.cpp">
|
||||
<Filter>[1] Ripple\ripple_app\_network</Filter>
|
||||
</ClCompile>
|
||||
@@ -717,9 +732,6 @@
|
||||
<ClCompile Include="..\..\src\cpp\ripple\RPCHandler.cpp">
|
||||
<Filter>[1] Ripple\ripple_app\_rpc</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\cpp\ripple\RPCServer.cpp">
|
||||
<Filter>[1] Ripple\ripple_app\_rpc</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\cpp\ripple\RPCSub.cpp">
|
||||
<Filter>[1] Ripple\ripple_app\_rpc</Filter>
|
||||
</ClCompile>
|
||||
@@ -825,6 +837,21 @@
|
||||
<ClCompile Include="..\..\modules\ripple_data\protocol\ripple_LedgerFormats.cpp">
|
||||
<Filter>[1] Ripple\ripple_data\protocol</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\modules\ripple_basio\ripple_basio.cpp">
|
||||
<Filter>[1] Ripple\ripple_basio</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\modules\ripple_basio\boost\ripple_IoService.cpp">
|
||||
<Filter>[1] Ripple\ripple_basio\boost</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\modules\ripple_net\ripple_net.cpp">
|
||||
<Filter>[1] Ripple\ripple_net</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\modules\ripple_net\basics\ripple_HTTPRequest.cpp">
|
||||
<Filter>[1] Ripple\ripple_net\basics</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\cpp\ripple\RPCServer.cpp">
|
||||
<Filter>[1] Ripple\ripple_app\_network</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\Subtrees\sqlite\sqlite3.h">
|
||||
@@ -1374,9 +1401,6 @@
|
||||
<ClInclude Include="..\..\src\cpp\ripple\ripple_SerializedTransaction.h">
|
||||
<Filter>[1] Ripple\ripple_app\_misc</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\cpp\ripple\HTTPRequest.h">
|
||||
<Filter>[1] Ripple\ripple_app\_network</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\cpp\ripple\HttpsClient.h">
|
||||
<Filter>[1] Ripple\ripple_app\_network</Filter>
|
||||
</ClInclude>
|
||||
@@ -1449,9 +1473,6 @@
|
||||
<ClInclude Include="..\..\src\cpp\ripple\RPCHandler.h">
|
||||
<Filter>[1] Ripple\ripple_app\_rpc</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\cpp\ripple\RPCServer.h">
|
||||
<Filter>[1] Ripple\ripple_app\_rpc</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\cpp\ripple\CallRPC.h">
|
||||
<Filter>[1] Ripple\ripple_app\_rpc</Filter>
|
||||
</ClInclude>
|
||||
@@ -1542,6 +1563,27 @@
|
||||
<ClInclude Include="..\..\modules\ripple_data\protocol\ripple_LedgerFormats.h">
|
||||
<Filter>[1] Ripple\ripple_data\protocol</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\modules\ripple_basio\ripple_basio.h">
|
||||
<Filter>[1] Ripple\ripple_basio</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\modules\ripple_basio\ripple_basio_impl.h">
|
||||
<Filter>[1] Ripple\ripple_basio</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\modules\ripple_basio\ripple_basio_fwdecl.h">
|
||||
<Filter>[1] Ripple\ripple_basio</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\modules\ripple_basio\boost\ripple_IoService.h">
|
||||
<Filter>[1] Ripple\ripple_basio\boost</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\modules\ripple_net\ripple_net.h">
|
||||
<Filter>[1] Ripple\ripple_net</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\modules\ripple_net\basics\ripple_HTTPRequest.h">
|
||||
<Filter>[1] Ripple\ripple_net\basics</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\cpp\ripple\RPCServer.h">
|
||||
<Filter>[1] Ripple\ripple_app\_network</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="..\..\src\cpp\ripple\ripple.proto" />
|
||||
@@ -1559,6 +1601,8 @@
|
||||
<None Include="..\..\CheatSheet.md" />
|
||||
<None Include="..\..\CodingStyle.md" />
|
||||
<None Include="..\..\Doxyfile" />
|
||||
<None Include="..\..\SConstruct" />
|
||||
<None Include="..\QtCreator\rippled.pro" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="..\..\TODO.txt" />
|
||||
|
||||
18
SConstruct
18
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'
|
||||
]
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
44
modules/ripple_basio/boost/ripple_IoService.cpp
Normal file
44
modules/ripple_basio/boost/ripple_IoService.cpp
Normal file
@@ -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 ();
|
||||
}
|
||||
|
||||
}
|
||||
37
modules/ripple_basio/boost/ripple_IoService.h
Normal file
37
modules/ripple_basio/boost/ripple_IoService.h
Normal file
@@ -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 <boost::asio::io_service> m_impl;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
26
modules/ripple_basio/ripple_basio.cpp
Normal file
26
modules/ripple_basio/ripple_basio.cpp
Normal file
@@ -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"
|
||||
|
||||
}
|
||||
34
modules/ripple_basio/ripple_basio.h
Normal file
34
modules/ripple_basio/ripple_basio.h
Normal file
@@ -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
|
||||
26
modules/ripple_basio/ripple_basio_fwdecl.h
Normal file
26
modules/ripple_basio/ripple_basio_fwdecl.h
Normal file
@@ -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
|
||||
23
modules/ripple_basio/ripple_basio_impl.h
Normal file
23
modules/ripple_basio/ripple_basio_impl.h
Normal file
@@ -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 <boost/asio/io_service.hpp>
|
||||
|
||||
/** Implementations for boost::asio abstractions.
|
||||
|
||||
These require boost::asio header material to be included.
|
||||
*/
|
||||
|
||||
namespace ripple
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -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);
|
||||
@@ -4,10 +4,15 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef HTTPREQUEST__HPP
|
||||
#define HTTPREQUEST__HPP
|
||||
#ifndef RIPPLE_HTTPREQUEST_H_INCLUDED
|
||||
#define RIPPLE_HTTPREQUEST_H_INCLUDED
|
||||
|
||||
enum HTTPRequestAction
|
||||
/** An HTTP request we are handling from a client.
|
||||
*/
|
||||
class HTTPRequest
|
||||
{
|
||||
public:
|
||||
enum Action
|
||||
{
|
||||
// What the application code needs to do
|
||||
haERROR = 0,
|
||||
@@ -17,11 +22,6 @@ enum HTTPRequestAction
|
||||
haCLOSE_CONN = 4
|
||||
};
|
||||
|
||||
class HTTPRequest
|
||||
{
|
||||
// an HTTP request we are handling from a client
|
||||
public:
|
||||
|
||||
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 ()
|
||||
{
|
||||
22
modules/ripple_net/ripple_net.cpp
Normal file
22
modules/ripple_net/ripple_net.cpp
Normal file
@@ -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"
|
||||
|
||||
}
|
||||
32
modules/ripple_net/ripple_net.h
Normal file
32
modules/ripple_net/ripple_net.h
Normal file
@@ -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
|
||||
@@ -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<basio::ip::tcp::socket> ssl_socket;
|
||||
typedef boost::asio::ssl::stream<boost::asio::ip::tcp::socket> ssl_socket;
|
||||
typedef boost::shared_ptr<ssl_socket> 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<void (error_code)> 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<ssl_socket> (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<ssl_socket> (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 <typename Allocator, typename Handler>
|
||||
void async_read_until (basio::basic_streambuf<Allocator>& buffers, const std::string& delim, Handler handler)
|
||||
void async_read_until (boost::asio::basic_streambuf<Allocator>& 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 <typename Allocator, typename MatchCondition, typename Handler>
|
||||
void async_read_until (basio::basic_streambuf<Allocator>& buffers, MatchCondition cond, Handler handler)
|
||||
void async_read_until (boost::asio::basic_streambuf<Allocator>& 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 <typename Buf, typename Handler>
|
||||
@@ -202,7 +199,7 @@ public:
|
||||
}
|
||||
|
||||
template <typename Allocator, typename Condition, typename Handler>
|
||||
void async_read (basio::basic_streambuf<Allocator>& buffers, Condition cond, Handler handler)
|
||||
void async_read (boost::asio::basic_streambuf<Allocator>& buffers, Condition cond, Handler handler)
|
||||
{
|
||||
if (isSecure ())
|
||||
boost::asio::async_read (*mSocket, buffers, cond, handler);
|
||||
|
||||
@@ -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<uint32> (-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 <uint32> (-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<uint32> (-1);
|
||||
}
|
||||
else if (mFetchPack.getCacheSize () > 64)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
mLastFetchPack = now;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user