diff --git a/modules/beast_asio/beast_asio.h b/modules/beast_asio/beast_asio.h index ac453b669..d537fe1ca 100644 --- a/modules/beast_asio/beast_asio.h +++ b/modules/beast_asio/beast_asio.h @@ -62,13 +62,13 @@ namespace beast #include "tests/beast_TestPeerLogic.h" #include "tests/beast_TestPeerTest.h" -#include "tests/detail/beast_TestPeerType.h" -#include "tests/detail/beast_TestPeerTestType.h" -#include "tests/detail/beast_TestPeerDetailsTcp.h" #include "tests/detail/beast_TestPeerLogicSyncServer.h" #include "tests/detail/beast_TestPeerLogicSyncClient.h" #include "tests/detail/beast_TestPeerLogicAsyncServer.h" #include "tests/detail/beast_TestPeerLogicAsyncClient.h" +#include "tests/detail/beast_TestPeerType.h" +#include "tests/detail/beast_TestPeerTestType.h" +#include "tests/detail/beast_TestPeerDetailsTcp.h" } diff --git a/modules/beast_asio/sockets/beast_SocketWrapper.h b/modules/beast_asio/sockets/beast_SocketWrapper.h index 8ead9fe06..073c4b587 100644 --- a/modules/beast_asio/sockets/beast_SocketWrapper.h +++ b/modules/beast_asio/sockets/beast_SocketWrapper.h @@ -72,7 +72,7 @@ public: // if Object did not have a declaration for // protocol_type::socket // - template + template struct native_socket { typedef void* native_socket_type; @@ -83,16 +83,15 @@ public: native_socket_type m_socket; }; - template - struct native_socket >::type> + template + struct native_socket >::type> { - typedef typename Object::protocol_type::socket native_socket_type; + typedef typename AsioObject::protocol_type::socket native_socket_type; native_socket (Socket& peer) : m_socket (&peer.this_layer ()) { } native_socket_type& get () noexcept { return *m_socket; } native_socket_type& operator-> () noexcept { return *m_socket; } - private: native_socket_type* m_socket; }; diff --git a/modules/beast_asio/tests/beast_TestPeerTests.cpp b/modules/beast_asio/tests/beast_TestPeerTests.cpp index 701051ae4..f67e7abe3 100644 --- a/modules/beast_asio/tests/beast_TestPeerTests.cpp +++ b/modules/beast_asio/tests/beast_TestPeerTests.cpp @@ -25,7 +25,7 @@ public: timeoutSeconds = 3 }; - TestPeerTests () : UnitTest ("TestPeer", "beast") + TestPeerTests () : UnitTest ("TestPeer", "beast", runManual) { } diff --git a/modules/beast_asio/tests/detail/beast_TestPeerDetailsTcp.h b/modules/beast_asio/tests/detail/beast_TestPeerDetailsTcp.h index e3fe27119..a9a8de49f 100644 --- a/modules/beast_asio/tests/detail/beast_TestPeerDetailsTcp.h +++ b/modules/beast_asio/tests/detail/beast_TestPeerDetailsTcp.h @@ -31,8 +31,6 @@ protected: typedef protocol_type::endpoint endpoint_type; typedef protocol_type::resolver resolver_type; - struct NoArg { }; // dummy - public: typedef protocol_type arg_type; typedef socket_type native_socket_type; diff --git a/modules/beast_asio/tests/detail/beast_TestPeerType.h b/modules/beast_asio/tests/detail/beast_TestPeerType.h index cbef2f81a..ad1d992ba 100644 --- a/modules/beast_asio/tests/detail/beast_TestPeerType.h +++ b/modules/beast_asio/tests/detail/beast_TestPeerType.h @@ -20,19 +20,49 @@ #ifndef BEAST_TESTPEERTYPE_H_INCLUDED #define BEAST_TESTPEERTYPE_H_INCLUDED -template +template class TestPeerType - : public DetailsType + : public Details , public Logic , public TestPeer , public Thread { +protected: + // TestPeerDetails + using Details::get_socket; + using Details::get_acceptor; + using Details::get_io_service; + + // Details + typedef typename Details::protocol_type protocol_type; + typedef typename Details::socket_type socket_type; + typedef typename Details::acceptor_type acceptor_type; + typedef typename Details::endpoint_type endpoint_type; + typedef typename Details::resolver_type resolver_type; + + using Details::get_native_socket; + using Details::get_native_acceptor; + using Details::get_endpoint; + + // TestPeerLogic + using Logic::error; + using Logic::socket; + using Logic::get_role; + using Logic::get_model; + using Logic::on_connect; + using Logic::on_connect_async; + using Logic::pure_virtual; + public: - typedef typename DetailsType::arg_type arg_type; - typedef TestPeerType ThisType; + // Details + typedef typename Details::arg_type arg_type; + typedef typename Details::native_socket_type native_socket_type; + typedef typename Details::native_acceptor_type native_acceptor_type; + + typedef TestPeerType ThisType; TestPeerType (arg_type const& arg) - : DetailsType (arg) + : Details (arg) , Logic (get_socket ()) , Thread (name ()) { @@ -162,13 +192,17 @@ public: if (failure (get_native_acceptor ().open (get_endpoint (get_role ()).protocol (), error ()))) return; - if (failure (get_native_acceptor ().set_option (socket_type::reuse_address (true), error ()))) + // VFALCO TODO Figure out how to not hard code boost::asio::socket_base + if (failure (get_native_acceptor ().set_option ( + boost::asio::socket_base::reuse_address (true), error ()))) return; if (failure (get_native_acceptor ().bind (get_endpoint (get_role ()), error ()))) return; - if (failure (get_native_acceptor ().listen (socket_type::max_connections, error ()))) + // VFALCO TODO Figure out how to not hard code boost::asio::socket_base + if (failure (get_native_acceptor ().listen ( + boost::asio::socket_base::max_connections, error ()))) return; } };