mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 19:15:54 +00:00
Move PeerRole to its own file
This commit is contained in:
@@ -72,6 +72,7 @@
|
|||||||
<ClInclude Include="..\..\modules\beast_asio\basics\beast_BufferType.h" />
|
<ClInclude Include="..\..\modules\beast_asio\basics\beast_BufferType.h" />
|
||||||
<ClInclude Include="..\..\modules\beast_asio\basics\beast_CompletionCall.h" />
|
<ClInclude Include="..\..\modules\beast_asio\basics\beast_CompletionCall.h" />
|
||||||
<ClInclude Include="..\..\modules\beast_asio\basics\beast_ErrorCall.h" />
|
<ClInclude Include="..\..\modules\beast_asio\basics\beast_ErrorCall.h" />
|
||||||
|
<ClInclude Include="..\..\modules\beast_asio\basics\beast_PeerRole.h" />
|
||||||
<ClInclude Include="..\..\modules\beast_asio\basics\beast_TransferCall.h" />
|
<ClInclude Include="..\..\modules\beast_asio\basics\beast_TransferCall.h" />
|
||||||
<ClInclude Include="..\..\modules\beast_asio\beast_asio.h" />
|
<ClInclude Include="..\..\modules\beast_asio\beast_asio.h" />
|
||||||
<ClInclude Include="..\..\modules\beast_asio\protocol\beast_ProxyHandshake.h" />
|
<ClInclude Include="..\..\modules\beast_asio\protocol\beast_ProxyHandshake.h" />
|
||||||
@@ -296,6 +297,12 @@
|
|||||||
<ClInclude Include="BeastConfig.h" />
|
<ClInclude Include="BeastConfig.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\..\modules\beast_asio\basics\beast_PeerRole.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\beast_asio\beast_asio.cpp" />
|
<ClCompile Include="..\..\modules\beast_asio\beast_asio.cpp" />
|
||||||
<ClCompile Include="..\..\modules\beast_asio\protocol\beast_ProxyHandshake.cpp">
|
<ClCompile Include="..\..\modules\beast_asio\protocol\beast_ProxyHandshake.cpp">
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||||
|
|||||||
@@ -833,6 +833,9 @@
|
|||||||
<ClInclude Include="..\..\modules\beast_asio\basics\beast_TransferCall.h">
|
<ClInclude Include="..\..\modules\beast_asio\basics\beast_TransferCall.h">
|
||||||
<Filter>beast_asio\basics</Filter>
|
<Filter>beast_asio\basics</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\modules\beast_asio\basics\beast_PeerRole.h">
|
||||||
|
<Filter>beast_asio\basics</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\modules\beast_core\beast_core.cpp">
|
<ClCompile Include="..\..\modules\beast_core\beast_core.cpp">
|
||||||
@@ -1291,6 +1294,9 @@
|
|||||||
<ClCompile Include="..\..\modules\beast_asio\tests\beast_TestPeerLogicProxyClient.cpp">
|
<ClCompile Include="..\..\modules\beast_asio\tests\beast_TestPeerLogicProxyClient.cpp">
|
||||||
<Filter>beast_asio\tests</Filter>
|
<Filter>beast_asio\tests</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\modules\beast_asio\basics\beast_PeerRole.cpp">
|
||||||
|
<Filter>beast_asio\basics</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Text Include="..\..\TODO.txt" />
|
<Text Include="..\..\TODO.txt" />
|
||||||
|
|||||||
44
Subtrees/beast/modules/beast_asio/basics/beast_PeerRole.cpp
Normal file
44
Subtrees/beast/modules/beast_asio/basics/beast_PeerRole.cpp
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
/*
|
||||||
|
This file is part of Beast: https://github.com/vinniefalco/Beast
|
||||||
|
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
|
copyright notice and this permission notice appear in all copies.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
//==============================================================================
|
||||||
|
|
||||||
|
PeerRole::PeerRole (role_t role)
|
||||||
|
: m_role (role)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
String PeerRole::name () const noexcept
|
||||||
|
{
|
||||||
|
if (m_role == server)
|
||||||
|
return "server";
|
||||||
|
return "client";
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PeerRole::operator== (role_t role) const noexcept
|
||||||
|
{
|
||||||
|
return m_role == role;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
PeerRole::operator Socket::handshake_type () const noexcept
|
||||||
|
{
|
||||||
|
if (m_role == server)
|
||||||
|
return Socket::server;
|
||||||
|
return Socket::client;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
40
Subtrees/beast/modules/beast_asio/basics/beast_PeerRole.h
Normal file
40
Subtrees/beast/modules/beast_asio/basics/beast_PeerRole.h
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
/*
|
||||||
|
This file is part of Beast: https://github.com/vinniefalco/Beast
|
||||||
|
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
|
copyright notice and this permission notice appear in all copies.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
//==============================================================================
|
||||||
|
|
||||||
|
#ifndef BEAST_PEERROLE_H_INCLUDED
|
||||||
|
#define BEAST_PEERROLE_H_INCLUDED
|
||||||
|
|
||||||
|
/** Identifies if the peer is a client or a server. */
|
||||||
|
struct PeerRole
|
||||||
|
{
|
||||||
|
enum role_t
|
||||||
|
{
|
||||||
|
client,
|
||||||
|
server
|
||||||
|
};
|
||||||
|
|
||||||
|
PeerRole (role_t role);
|
||||||
|
String name () const noexcept;
|
||||||
|
bool operator== (role_t role) const noexcept;
|
||||||
|
|
||||||
|
private:
|
||||||
|
role_t m_role;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -24,6 +24,8 @@
|
|||||||
namespace beast
|
namespace beast
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#include "basics/beast_PeerRole.cpp"
|
||||||
|
|
||||||
#include "sockets/beast_SocketBase.cpp"
|
#include "sockets/beast_SocketBase.cpp"
|
||||||
#include "sockets/beast_Socket.cpp"
|
#include "sockets/beast_Socket.cpp"
|
||||||
#include "sockets/beast_SslContext.cpp"
|
#include "sockets/beast_SslContext.cpp"
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ namespace beast
|
|||||||
|
|
||||||
// Order matters
|
// Order matters
|
||||||
|
|
||||||
|
#include "basics/beast_PeerRole.h"
|
||||||
#include "basics/beast_BufferType.h"
|
#include "basics/beast_BufferType.h"
|
||||||
#include "basics/beast_CompletionCall.h"
|
#include "basics/beast_CompletionCall.h"
|
||||||
#include "basics/beast_ErrorCall.h"
|
#include "basics/beast_ErrorCall.h"
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <boost/array.hpp>
|
||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
#include <boost/asio/ssl.hpp>
|
#include <boost/asio/ssl.hpp>
|
||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
|
|||||||
@@ -17,32 +17,6 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
TestPeerBasics::Role::Role (role_t role)
|
|
||||||
: m_role (role)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
String TestPeerBasics::Role::name () const noexcept
|
|
||||||
{
|
|
||||||
if (m_role == server)
|
|
||||||
return "server";
|
|
||||||
return "client";
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TestPeerBasics::Role::operator== (role_t role) const noexcept
|
|
||||||
{
|
|
||||||
return m_role == role;
|
|
||||||
}
|
|
||||||
|
|
||||||
TestPeerBasics::Role::operator Socket::handshake_type () const noexcept
|
|
||||||
{
|
|
||||||
if (m_role == server)
|
|
||||||
return Socket::server;
|
|
||||||
return Socket::client;
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
TestPeerBasics::Model::Model (model_t model)
|
TestPeerBasics::Model::Model (model_t model)
|
||||||
: m_model (model)
|
: m_model (model)
|
||||||
{
|
{
|
||||||
@@ -60,6 +34,14 @@ bool TestPeerBasics::Model::operator== (model_t model) const noexcept
|
|||||||
return m_model == model;
|
return m_model == model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boost::asio::ssl::stream_base::handshake_type
|
||||||
|
TestPeerBasics::to_handshake_type (PeerRole const& role)
|
||||||
|
{
|
||||||
|
if (role == PeerRole::client)
|
||||||
|
return boost::asio::ssl::stream_base::client;
|
||||||
|
return boost::asio::ssl::stream_base::server;
|
||||||
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
boost::system::error_category const& TestPeerBasics::test_category () noexcept
|
boost::system::error_category const& TestPeerBasics::test_category () noexcept
|
||||||
|
|||||||
@@ -27,26 +27,6 @@
|
|||||||
class TestPeerBasics
|
class TestPeerBasics
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Identifies if the peer is a client or a server. */
|
|
||||||
struct Role
|
|
||||||
{
|
|
||||||
enum role_t
|
|
||||||
{
|
|
||||||
client,
|
|
||||||
server
|
|
||||||
};
|
|
||||||
|
|
||||||
Role (role_t role);
|
|
||||||
String name () const noexcept;
|
|
||||||
bool operator== (role_t role) const noexcept;
|
|
||||||
operator Socket::handshake_type () const noexcept;
|
|
||||||
|
|
||||||
private:
|
|
||||||
role_t m_role;
|
|
||||||
};
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/** Selects between synchronous or asynchronous networking i/o usage. */
|
/** Selects between synchronous or asynchronous networking i/o usage. */
|
||||||
struct Model
|
struct Model
|
||||||
{
|
{
|
||||||
@@ -66,6 +46,11 @@ public:
|
|||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/** Convert a PeerRole to boost::asio::ssl::stream_base_handshake_type */
|
||||||
|
static boost::asio::ssl::stream_base::handshake_type to_handshake_type (PeerRole const& role);
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
// Custom error codes for distinguishing test conditions
|
// Custom error codes for distinguishing test conditions
|
||||||
struct errc
|
struct errc
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -79,18 +79,18 @@ public:
|
|||||||
return m_acceptor;
|
return m_acceptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
endpoint_type get_endpoint (TestPeer::Role role)
|
endpoint_type get_endpoint (PeerRole role)
|
||||||
{
|
{
|
||||||
if (m_protocol == protocol_type::v4 ())
|
if (m_protocol == protocol_type::v4 ())
|
||||||
{
|
{
|
||||||
if (role == TestPeer::Role::server)
|
if (role == PeerRole::server)
|
||||||
return endpoint_type (m_protocol, 1053);
|
return endpoint_type (m_protocol, 1053);
|
||||||
else
|
else
|
||||||
return endpoint_type (boost::asio::ip::address_v4::loopback (), 1053);
|
return endpoint_type (boost::asio::ip::address_v4::loopback (), 1053);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (role == TestPeer::Role::server)
|
if (role == PeerRole::server)
|
||||||
return endpoint_type (m_protocol, 1052);
|
return endpoint_type (m_protocol, 1052);
|
||||||
else
|
else
|
||||||
return endpoint_type (boost::asio::ip::address_v6 ().from_string ("::1"), 1052);
|
return endpoint_type (boost::asio::ip::address_v6 ().from_string ("::1"), 1052);
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public:
|
|||||||
|
|
||||||
Socket& socket () noexcept;
|
Socket& socket () noexcept;
|
||||||
|
|
||||||
virtual Role get_role () const noexcept = 0;
|
virtual PeerRole get_role () const noexcept = 0;
|
||||||
|
|
||||||
virtual Model get_model () const noexcept = 0;
|
virtual Model get_model () const noexcept = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -22,9 +22,9 @@ TestPeerLogicAsyncClient::TestPeerLogicAsyncClient (Socket& socket)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
TestPeerBasics::Role TestPeerLogicAsyncClient::get_role () const noexcept
|
PeerRole TestPeerLogicAsyncClient::get_role () const noexcept
|
||||||
{
|
{
|
||||||
return Role::client;
|
return PeerRole::client;
|
||||||
}
|
}
|
||||||
|
|
||||||
TestPeerBasics::Model TestPeerLogicAsyncClient::get_model () const noexcept
|
TestPeerBasics::Model TestPeerLogicAsyncClient::get_model () const noexcept
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class TestPeerLogicAsyncClient : public TestPeerLogic
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit TestPeerLogicAsyncClient (Socket& socket);
|
explicit TestPeerLogicAsyncClient (Socket& socket);
|
||||||
Role get_role () const noexcept;
|
PeerRole get_role () const noexcept;
|
||||||
Model get_model () const noexcept;
|
Model get_model () const noexcept;
|
||||||
void on_connect_async (error_code const& ec);
|
void on_connect_async (error_code const& ec);
|
||||||
void on_handshake (error_code const& ec);
|
void on_handshake (error_code const& ec);
|
||||||
|
|||||||
@@ -22,9 +22,9 @@ TestPeerLogicAsyncServer::TestPeerLogicAsyncServer (Socket& socket)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
TestPeerBasics::Role TestPeerLogicAsyncServer::get_role () const noexcept
|
PeerRole TestPeerLogicAsyncServer::get_role () const noexcept
|
||||||
{
|
{
|
||||||
return Role::server;
|
return PeerRole::server;
|
||||||
}
|
}
|
||||||
|
|
||||||
TestPeerBasics::Model TestPeerLogicAsyncServer::get_model () const noexcept
|
TestPeerBasics::Model TestPeerLogicAsyncServer::get_model () const noexcept
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class TestPeerLogicAsyncServer : public TestPeerLogic
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit TestPeerLogicAsyncServer (Socket& socket);
|
explicit TestPeerLogicAsyncServer (Socket& socket);
|
||||||
Role get_role () const noexcept;
|
PeerRole get_role () const noexcept;
|
||||||
Model get_model () const noexcept;
|
Model get_model () const noexcept;
|
||||||
void on_connect_async (error_code const& ec);
|
void on_connect_async (error_code const& ec);
|
||||||
void on_handshake (error_code const& ec);
|
void on_handshake (error_code const& ec);
|
||||||
|
|||||||
@@ -22,9 +22,9 @@ TestPeerLogicSyncClient::TestPeerLogicSyncClient (Socket& socket)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
TestPeerBasics::Role TestPeerLogicSyncClient::get_role () const noexcept
|
PeerRole TestPeerLogicSyncClient::get_role () const noexcept
|
||||||
{
|
{
|
||||||
return Role::client;
|
return PeerRole::client;
|
||||||
}
|
}
|
||||||
|
|
||||||
TestPeerBasics::Model TestPeerLogicSyncClient::get_model () const noexcept
|
TestPeerBasics::Model TestPeerLogicSyncClient::get_model () const noexcept
|
||||||
@@ -43,7 +43,7 @@ void TestPeerLogicSyncClient::on_connect ()
|
|||||||
|
|
||||||
if (socket ().requires_handshake ())
|
if (socket ().requires_handshake ())
|
||||||
{
|
{
|
||||||
if (failure (socket ().handshake (get_role (), error ())))
|
if (failure (socket ().handshake (to_handshake_type (get_role ()), error ())))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class TestPeerLogicSyncClient : public TestPeerLogic
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit TestPeerLogicSyncClient (Socket& socket);
|
explicit TestPeerLogicSyncClient (Socket& socket);
|
||||||
Role get_role () const noexcept;
|
PeerRole get_role () const noexcept;
|
||||||
Model get_model () const noexcept;
|
Model get_model () const noexcept;
|
||||||
void on_connect ();
|
void on_connect ();
|
||||||
virtual void on_pre_handshake ();
|
virtual void on_pre_handshake ();
|
||||||
|
|||||||
@@ -22,9 +22,9 @@ TestPeerLogicSyncServer::TestPeerLogicSyncServer (Socket& socket)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
TestPeerBasics::Role TestPeerLogicSyncServer::get_role () const noexcept
|
PeerRole TestPeerLogicSyncServer::get_role () const noexcept
|
||||||
{
|
{
|
||||||
return Role::server;
|
return PeerRole::server;
|
||||||
}
|
}
|
||||||
|
|
||||||
TestPeerBasics::Model TestPeerLogicSyncServer::get_model () const noexcept
|
TestPeerBasics::Model TestPeerLogicSyncServer::get_model () const noexcept
|
||||||
@@ -36,7 +36,7 @@ void TestPeerLogicSyncServer::on_connect ()
|
|||||||
{
|
{
|
||||||
if (socket ().requires_handshake ())
|
if (socket ().requires_handshake ())
|
||||||
{
|
{
|
||||||
if (failure (socket ().handshake (get_role (), error ())))
|
if (failure (socket ().handshake (to_handshake_type (get_role ()), error ())))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class TestPeerLogicSyncServer : public TestPeerLogic
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit TestPeerLogicSyncServer (Socket& socket);
|
explicit TestPeerLogicSyncServer (Socket& socket);
|
||||||
Role get_role () const noexcept;
|
PeerRole get_role () const noexcept;
|
||||||
Model get_model () const noexcept;
|
Model get_model () const noexcept;
|
||||||
void on_connect ();
|
void on_connect ();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -175,11 +175,11 @@ public:
|
|||||||
{
|
{
|
||||||
if (is_async ())
|
if (is_async ())
|
||||||
{
|
{
|
||||||
if (get_role () == Role::server)
|
if (get_role () == PeerRole::server)
|
||||||
{
|
{
|
||||||
run_async_server ();
|
run_async_server ();
|
||||||
}
|
}
|
||||||
else if (get_role () == Role::client)
|
else if (get_role () == PeerRole::client)
|
||||||
{
|
{
|
||||||
run_async_client ();
|
run_async_client ();
|
||||||
}
|
}
|
||||||
@@ -190,11 +190,11 @@ public:
|
|||||||
}
|
}
|
||||||
else if (get_model () == Model::sync)
|
else if (get_model () == Model::sync)
|
||||||
{
|
{
|
||||||
if (get_role () == Role::server)
|
if (get_role () == PeerRole::server)
|
||||||
{
|
{
|
||||||
run_sync_server ();
|
run_sync_server ();
|
||||||
}
|
}
|
||||||
else if (get_role () == Role::client)
|
else if (get_role () == PeerRole::client)
|
||||||
{
|
{
|
||||||
run_sync_client ();
|
run_sync_client ();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -149,18 +149,18 @@ public:
|
|||||||
return m_acceptor;
|
return m_acceptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
endpoint_type get_endpoint (TestPeer::Role role)
|
endpoint_type get_endpoint (PeerRole role)
|
||||||
{
|
{
|
||||||
if (getFlags () & MultiSocketDetails::tcpv6)
|
if (getFlags () & MultiSocketDetails::tcpv6)
|
||||||
{
|
{
|
||||||
if (role == TestPeer::Role::server)
|
if (role == PeerRole::server)
|
||||||
return endpoint_type (boost::asio::ip::tcp::v6 (), 1052);
|
return endpoint_type (boost::asio::ip::tcp::v6 (), 1052);
|
||||||
else
|
else
|
||||||
return endpoint_type (boost::asio::ip::address_v6 ().from_string ("::1"), 1052);
|
return endpoint_type (boost::asio::ip::address_v6 ().from_string ("::1"), 1052);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (role == TestPeer::Role::server)
|
if (role == PeerRole::server)
|
||||||
return endpoint_type (boost::asio::ip::address_v4::any (), 1053);
|
return endpoint_type (boost::asio::ip::address_v4::any (), 1053);
|
||||||
else
|
else
|
||||||
return endpoint_type (boost::asio::ip::address_v4::loopback (), 1053);
|
return endpoint_type (boost::asio::ip::address_v4::loopback (), 1053);
|
||||||
|
|||||||
Reference in New Issue
Block a user