diff --git a/Subtrees/beast/modules/beast_asio/sockets/beast_SocketBase.cpp b/Subtrees/beast/modules/beast_asio/sockets/beast_SocketBase.cpp index cb17009ca..caa6b91a7 100644 --- a/Subtrees/beast/modules/beast_asio/sockets/beast_SocketBase.cpp +++ b/Subtrees/beast/modules/beast_asio/sockets/beast_SocketBase.cpp @@ -17,6 +17,12 @@ */ //============================================================================== +boost::system::error_code SocketBase::pure_virtual_error () +{ + return boost::system::errc::make_error_code ( + boost::system::errc::function_not_supported); +} + void SocketBase::pure_virtual () { fatal_error ("A beast::Socket function was called on an object that doesn't support the interface"); @@ -25,6 +31,6 @@ void SocketBase::pure_virtual () boost::system::error_code SocketBase::pure_virtual (boost::system::error_code& ec) { pure_virtual (); - return ec = boost::system::errc::make_error_code ( - boost::system::errc::function_not_supported); + ec = pure_virtual_error (); + return ec; } diff --git a/Subtrees/beast/modules/beast_asio/sockets/beast_SocketBase.h b/Subtrees/beast/modules/beast_asio/sockets/beast_SocketBase.h index f8e20f5a3..54507c195 100644 --- a/Subtrees/beast/modules/beast_asio/sockets/beast_SocketBase.h +++ b/Subtrees/beast/modules/beast_asio/sockets/beast_SocketBase.h @@ -25,8 +25,9 @@ */ struct SocketBase { - static void pure_virtual (); + static boost::system::error_code pure_virtual_error (); static boost::system::error_code pure_virtual (boost::system::error_code& ec); + static void pure_virtual (); /** Called when the underlying object does not support the interface. */ void throw_error (boost::system::error_code const& ec) diff --git a/Subtrees/beast/modules/beast_asio/sockets/beast_SocketWrapper.h b/Subtrees/beast/modules/beast_asio/sockets/beast_SocketWrapper.h index 47cfa48af..d13f3923e 100644 --- a/Subtrees/beast/modules/beast_asio/sockets/beast_SocketWrapper.h +++ b/Subtrees/beast/modules/beast_asio/sockets/beast_SocketWrapper.h @@ -394,18 +394,15 @@ public: boost::asio::detail::async_result_init< AcceptHandler, void (error_code)> init( BOOST_ASIO_MOVE_CAST(AcceptHandler)(handler)); - error_code ec; - ec = pure_virtual (ec); // init.handler is copied get_io_service ().post (CompletionCall ( - AcceptHandler (init.handler), ec)); + AcceptHandler (init.handler), pure_virtual_error ())); return init.result.get(); #else - error_code ec; - ec = pure_virtual (ec); - get_io_service ().post (boost::bind ( - BOOST_ASIO_MOVE_CAST(AcceptHandler)(handler), ec)); + get_io_service ().post (CompletionCall ( + BOOST_ASIO_MOVE_CAST(AcceptHandler)(handler), + pure_virtual_error ())); #endif } @@ -493,18 +490,15 @@ public: boost::asio::detail::async_result_init< ReadHandler, void (error_code, std::size_t)> init( BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); - error_code ec; - ec = pure_virtual (ec); // init.handler is copied get_io_service ().post (CompletionCall ( - ReadHandler (init.handler), ec, 0)); + ReadHandler (init.handler), pure_virtual_error (), 0)); return init.result.get(); #else - error_code ec; - ec = pure_virtual (ec); - get_io_service ().post (boost::bind ( - BOOST_ASIO_MOVE_CAST(ReadHandler)(handler), ec, 0)); + get_io_service ().post (CompletionCall ( + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler), + pure_virtual_error (), 0)); #endif } @@ -537,18 +531,15 @@ public: boost::asio::detail::async_result_init< TransferCall, void (error_code, std::size_t)> init( BOOST_ASIO_MOVE_CAST(TransferCall)(handler)); - error_code ec; - ec = pure_virtual (ec); // init.handler is copied get_io_service ().post (CompletionCall ( - TransferCall (init.handler), ec, 0)); + TransferCall (init.handler), pure_virtual_error (), 0)); return init.result.get(); #else - error_code ec; - ec = pure_virtual (ec); - get_io_service ().post (boost::bind ( - BOOST_ASIO_MOVE_CAST(TransferCall)(handler), ec, 0)); + get_io_service ().post (CompletionCall ( + BOOST_ASIO_MOVE_CAST(TransferCall)(handler), + pure_virtual_error (), 0)); #endif } @@ -619,17 +610,14 @@ public: boost::asio::detail::async_result_init< ErrorCall, void (error_code)> init( BOOST_ASIO_MOVE_CAST(ErrorCall)(handler)); - error_code ec; - ec = pure_virtual (ec); // init.handler is copied get_io_service ().post (CompletionCall ( - ErrorCall (init.handler), ec)); + ErrorCall (init.handler), pure_virtual_error ())); return init.result.get(); #else - error_code ec; - ec = pure_virtual (ec); - get_io_service ().post (boost::bind ( - BOOST_ASIO_MOVE_CAST(ErrorCall)(handler), ec)); + get_io_service ().post (CompletionCall ( + BOOST_ASIO_MOVE_CAST(ErrorCall)(handler), + pure_virtual_error ())); #endif } @@ -686,18 +674,15 @@ public: boost::asio::detail::async_result_init< TransferCall, void (error_code, std::size_t)> init( BOOST_ASIO_MOVE_CAST(TransferCall)(handler)); - error_code ec; - ec = pure_virtual (ec); // init.handler is copied get_io_service ().post (CompletionCall ( - TransferCall (init.handler), ec, 0)); + TransferCall (init.handler), pure_virtual_error (), 0)); return init.result.get(); #else - error_code ec; - ec = pure_virtual (ec); - get_io_service ().post (boost::bind ( - BOOST_ASIO_MOVE_CAST(TransferCall)(handler), ec, 0)); + get_io_service ().post (CompletionCall ( + BOOST_ASIO_MOVE_CAST(TransferCall)(handler), + pure_virtual_error (), 0)); #endif } @@ -753,18 +738,15 @@ public: boost::asio::detail::async_result_init< ErrorCall, void (error_code, std::size_t)> init( BOOST_ASIO_MOVE_CAST(ErrorCall)(handler)); - error_code ec; - ec = pure_virtual (ec); // init.handler is copied get_io_service ().post (CompletionCall ( - ErrorCall (init.handler), ec)); + ErrorCall (init.handler), pure_virtual_error ())); return init.result.get(); #else - error_code ec; - ec = pure_virtual (ec); - get_io_service ().post (boost::bind ( - BOOST_ASIO_MOVE_CAST(ErrorCall)(handler), ec)); + get_io_service ().post (CompletionCall ( + BOOST_ASIO_MOVE_CAST(ErrorCall)(handler), + pure_virtual_error ())); #endif }