Update MultiSocket to use new beast asio APIs

This commit is contained in:
Vinnie Falco
2013-08-21 17:07:34 -07:00
parent 647acebdbf
commit 8e95ee6ed3
5 changed files with 616 additions and 451 deletions

View File

@@ -143,6 +143,18 @@
#define BEAST_DISABLE_CONTRACT_CHECKS 0 #define BEAST_DISABLE_CONTRACT_CHECKS 0
#endif #endif
//------------------------------------------------------------------------------
/** Config: BEAST_COMPILER_CHECKS_SOCKET_OVERRIDES
Setting this option makes Socket-derived classes generate compile errors if
they forget any of the virtual overrides As some Socket-derived classes
intentionally omit member functions that are not applicable, this macro
should only be enabled temporarily when writing your own Socket-derived class,
to make sure that the function signatures match as expected.
*/
#define BEAST_COMPILER_CHECKS_SOCKET_OVERRIDES 0
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// //
// Ripple compilation settings // Ripple compilation settings
@@ -161,7 +173,7 @@
#define RIPPLE_USES_BEAST_SOCKETS 0 #define RIPPLE_USES_BEAST_SOCKETS 0
#define BEAST_ASIO_HAS_BUFFEREDHANDSHAKE 0 //#define BEAST_ASIO_HAS_BUFFEREDHANDSHAKE 0
//#define BEAST_ASIO_HAS_FUTURE_RETURNS 0 //#define BEAST_ASIO_HAS_FUTURE_RETURNS 0
#endif #endif

View File

@@ -1665,7 +1665,6 @@
<None Include="..\QtCreator\rippled.pro" /> <None Include="..\QtCreator\rippled.pro" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Text Include="..\..\Notes\VFALCO_LOG.txt" />
<Text Include="..\..\Notes\VFALCO_TODO.txt" /> <Text Include="..\..\Notes\VFALCO_TODO.txt" />
</ItemGroup> </ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">

View File

@@ -1724,9 +1724,6 @@
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Text Include="..\..\Notes\VFALCO_LOG.txt">
<Filter>%28Notes%29</Filter>
</Text>
<Text Include="..\..\Notes\VFALCO_TODO.txt"> <Text Include="..\..\Notes\VFALCO_TODO.txt">
<Filter>%28Notes%29</Filter> <Filter>%28Notes%29</Filter>
</Text> </Text>

View File

@@ -4,8 +4,6 @@
*/ */
//============================================================================== //==============================================================================
#define MULTISOCKET_TEST_PROXY 1
MultiSocket* MultiSocket::New (boost::asio::io_service& io_service, int flags) MultiSocket* MultiSocket::New (boost::asio::io_service& io_service, int flags)
{ {
return new MultiSocketType <boost::asio::ip::tcp::socket> (io_service, flags); return new MultiSocketType <boost::asio::ip::tcp::socket> (io_service, flags);
@@ -183,6 +181,7 @@ public:
TestPeerLogicSyncClient, TestPeerLogicAsyncServer> TestPeerLogicSyncClient, TestPeerLogicAsyncServer>
(clientArg, serverArg, timeoutSeconds).report (*this); (clientArg, serverArg, timeoutSeconds).report (*this);
PeerTest::run <MultiSocketDetailsType <Protocol>, PeerTest::run <MultiSocketDetailsType <Protocol>,
TestPeerLogicAsyncClient, TestPeerLogicAsyncServer> TestPeerLogicAsyncClient, TestPeerLogicAsyncServer>
(clientArg, serverArg, timeoutSeconds).report (*this); (clientArg, serverArg, timeoutSeconds).report (*this);
@@ -213,21 +212,41 @@ public:
template <typename Protocol> template <typename Protocol>
void testProtocol () void testProtocol ()
{ {
// These should pass. // Simple tests
run <Protocol> (0, 0); run <Protocol> (0,
run <Protocol> (MultiSocket::Flag::client_role, 0); 0);
run <Protocol> (MultiSocket::Flag::client_role,
0);
run <Protocol> (0, MultiSocket::Flag::server_role); run <Protocol> (0, MultiSocket::Flag::server_role);
run <Protocol> (MultiSocket::Flag::client_role, MultiSocket::Flag::server_role);
// These should pass run <Protocol> (MultiSocket::Flag::client_role,
testFlags <Protocol> (MultiSocket::Flag::ssl, MultiSocket::Flag::ssl_required); MultiSocket::Flag::server_role);
testFlags <Protocol> (0, MultiSocket::Flag::ssl);
testFlags <Protocol> (MultiSocket::Flag::ssl, MultiSocket::Flag::ssl);
testProxyFlags <Protocol> (MultiSocket::Flag::proxy, MultiSocket::Flag::proxy); testFlags <Protocol> (MultiSocket::Flag::ssl,
testProxyFlags <Protocol> (MultiSocket::Flag::proxy | MultiSocket::Flag::ssl, MultiSocket::Flag::proxy | MultiSocket::Flag::ssl_required); MultiSocket::Flag::ssl_required);
testProxyFlags <Protocol> (MultiSocket::Flag::proxy, MultiSocket::Flag::proxy | MultiSocket::Flag::ssl);
testProxyFlags <Protocol> (MultiSocket::Flag::proxy | MultiSocket::Flag::ssl, MultiSocket::Flag::proxy | MultiSocket::Flag::ssl); // SSL-Detect tests
testFlags <Protocol> (0,
MultiSocket::Flag::ssl);
testFlags <Protocol> (MultiSocket::Flag::ssl,
MultiSocket::Flag::ssl);
// PROXY Handshake tests
testProxyFlags <Protocol> (MultiSocket::Flag::proxy,
MultiSocket::Flag::proxy);
testProxyFlags <Protocol> (MultiSocket::Flag::proxy | MultiSocket::Flag::ssl,
MultiSocket::Flag::proxy | MultiSocket::Flag::ssl_required);
// PROXY + SSL-Detect tests
testProxyFlags <Protocol> (MultiSocket::Flag::proxy,
MultiSocket::Flag::proxy | MultiSocket::Flag::ssl);
testProxyFlags <Protocol> (MultiSocket::Flag::proxy | MultiSocket::Flag::ssl,
MultiSocket::Flag::proxy | MultiSocket::Flag::ssl);
} }
void runTest () void runTest ()

File diff suppressed because it is too large Load Diff