From 21c28ffd6b3db99df79b637efeffb1e9525dca9a Mon Sep 17 00:00:00 2001 From: Casey Langen Date: Sun, 16 Jun 2019 18:53:29 -0700 Subject: [PATCH] Fixed Boost 1.70 compatibility to restore macOS compile. Manually applied this patch: https://github.com/zaphoyd/websocketpp/pull/814 --- .../websocketpp/transport/asio/connection.hpp | 27 +++++++++---------- .../websocketpp/transport/asio/endpoint.hpp | 22 +++++++-------- .../transport/asio/security/none.hpp | 11 ++++---- .../transport/asio/security/tls.hpp | 9 +++---- 4 files changed, 31 insertions(+), 38 deletions(-) diff --git a/src/plugins/server/3rdparty/include/websocketpp/transport/asio/connection.hpp b/src/plugins/server/3rdparty/include/websocketpp/transport/asio/connection.hpp index 311fc9c0f..36c1cafcf 100644 --- a/src/plugins/server/3rdparty/include/websocketpp/transport/asio/connection.hpp +++ b/src/plugins/server/3rdparty/include/websocketpp/transport/asio/connection.hpp @@ -120,7 +120,7 @@ class connection : public config::socket_type::socket_con_type { * Called by the endpoint as a connection is being established to provide * the uri being connected to to the transport layer. * - * This transport policy doesn't use the uri except to forward it to the + * This transport policy doesn't use the uri except to forward it to the * socket layer. * * @since 0.6.0 @@ -311,10 +311,10 @@ class connection : public config::socket_type::socket_con_type { * needed. */ timer_ptr set_timer(long duration, timer_handler callback) { - timer_ptr new_timer = lib::make_shared( - lib::ref(*m_io_service), - lib::asio::milliseconds(duration) - ); + timer_ptr new_timer( + new lib::asio::steady_timer( + *m_io_service, + lib::asio::milliseconds(duration))); if (config::enable_multithreading) { new_timer->async_wait(m_strand->wrap(lib::bind( @@ -375,14 +375,14 @@ class connection : public config::socket_type::socket_con_type { * Primarily used if you are using mismatched asio / system_error * implementations such as `boost::asio` with `std::system_error`. In these * cases the transport error type is different than the library error type - * and some WebSocket++ functions that return transport errors via the + * and some WebSocket++ functions that return transport errors via the * library error code type will be coerced into a catch all `pass_through` - * or `tls_error` error. This method will return the original machine + * or `tls_error` error. This method will return the original machine * readable transport error in the native type. * * @since 0.7.0 * - * @return Error code indicating the reason the connection was closed or + * @return Error code indicating the reason the connection was closed or * failed */ lib::asio::error_code get_transport_ec() const { @@ -461,8 +461,7 @@ class connection : public config::socket_type::socket_con_type { m_io_service = io_service; if (config::enable_multithreading) { - m_strand = lib::make_shared( - lib::ref(*io_service)); + m_strand.reset(new lib::asio::io_service::strand(*io_service)); } lib::error_code ec = socket_con_type::init_asio(io_service, m_strand, @@ -499,7 +498,7 @@ class connection : public config::socket_type::socket_con_type { } timer_ptr post_timer; - + if (config::timeout_socket_post_init > 0) { post_timer = set_timer( config::timeout_socket_post_init, @@ -863,9 +862,9 @@ class connection : public config::socket_type::socket_con_type { lib::placeholders::_1, lib::placeholders::_2 ) ) - ); + ); } - + } void handle_async_read(read_handler handler, lib::asio::error_code const & ec, @@ -1067,7 +1066,7 @@ class connection : public config::socket_type::socket_con_type { * @param callback The function to call back * @param ec The status code */ - void handle_async_shutdown_timeout(timer_ptr, init_handler callback, + void handle_async_shutdown_timeout(timer_ptr, init_handler callback, lib::error_code const & ec) { lib::error_code ret_ec; diff --git a/src/plugins/server/3rdparty/include/websocketpp/transport/asio/endpoint.hpp b/src/plugins/server/3rdparty/include/websocketpp/transport/asio/endpoint.hpp index dad25d91e..f3d2d30c0 100644 --- a/src/plugins/server/3rdparty/include/websocketpp/transport/asio/endpoint.hpp +++ b/src/plugins/server/3rdparty/include/websocketpp/transport/asio/endpoint.hpp @@ -157,7 +157,7 @@ class endpoint : public config::socket_type { rhs.m_acceptor = NULL; rhs.m_listen_backlog = lib::asio::socket_base::max_connections; rhs.m_state = UNINITIALIZED; - + // TODO: this needs to be updated } return *this; @@ -191,8 +191,7 @@ class endpoint : public config::socket_type { m_io_service = ptr; m_external_io_service = true; - m_acceptor = lib::make_shared( - lib::ref(*m_io_service)); + m_acceptor.reset(new lib::asio::ip::tcp::acceptor(*m_io_service)); m_state = READY; ec = lib::error_code(); @@ -222,7 +221,7 @@ class endpoint : public config::socket_type { * @param ec Set to indicate what error occurred, if any. */ void init_asio(lib::error_code & ec) { - // Use a smart pointer until the call is successful and ownership has + // Use a smart pointer until the call is successful and ownership has // successfully been taken. Use unique_ptr when available. // TODO: remove the use of auto_ptr when C++98/03 support is no longer // necessary. @@ -244,7 +243,7 @@ class endpoint : public config::socket_type { * @see init_asio(io_service_ptr ptr) */ void init_asio() { - // Use a smart pointer until the call is successful and ownership has + // Use a smart pointer until the call is successful and ownership has // successfully been taken. Use unique_ptr when available. // TODO: remove the use of auto_ptr when C++98/03 support is no longer // necessary. @@ -357,7 +356,7 @@ class endpoint : public config::socket_type { lib::asio::io_service & get_io_service() { return *m_io_service; } - + /// Get local TCP endpoint /** * Extracts the local endpoint from the acceptor. This represents the @@ -365,7 +364,7 @@ class endpoint : public config::socket_type { * * Sets a bad_descriptor error if the acceptor is not currently listening * or otherwise unavailable. - * + * * @since 0.7.0 * * @param ec Set to indicate what error occurred, if any. @@ -660,9 +659,7 @@ class endpoint : public config::socket_type { * @since 0.3.0 */ void start_perpetual() { - m_work = lib::make_shared( - lib::ref(*m_io_service) - ); + m_work.reset(new lib::asio::io_service::work(*m_io_service)); } /// Clears the endpoint's perpetual flag, allowing it to exit when empty @@ -800,7 +797,7 @@ class endpoint : public config::socket_type { m_elog = e; } - void handle_accept(accept_handler callback, lib::asio::error_code const & + void handle_accept(accept_handler callback, lib::asio::error_code const & asio_ec) { lib::error_code ret_ec; @@ -826,8 +823,7 @@ class endpoint : public config::socket_type { // Create a resolver if (!m_resolver) { - m_resolver = lib::make_shared( - lib::ref(*m_io_service)); + m_resolver.reset(new lib::asio::ip::tcp::resolver(*m_io_service)); } tcon->set_uri(u); diff --git a/src/plugins/server/3rdparty/include/websocketpp/transport/asio/security/none.hpp b/src/plugins/server/3rdparty/include/websocketpp/transport/asio/security/none.hpp index 0e68a65c8..73c03fdbd 100644 --- a/src/plugins/server/3rdparty/include/websocketpp/transport/asio/security/none.hpp +++ b/src/plugins/server/3rdparty/include/websocketpp/transport/asio/security/none.hpp @@ -168,8 +168,7 @@ class connection : public lib::enable_shared_from_this { return socket::make_error_code(socket::error::invalid_state); } - m_socket = lib::make_shared( - lib::ref(*service)); + m_socket.reset(new lib::asio::ip::tcp::socket(*service)); m_state = READY; @@ -263,14 +262,14 @@ class connection : public lib::enable_shared_from_this { /// Translate any security policy specific information about an error code /** - * Translate_ec takes an Asio error code and attempts to convert its value + * Translate_ec takes an Asio error code and attempts to convert its value * to an appropriate websocketpp error code. In the case that the Asio and * Websocketpp error types are the same (such as using boost::asio and * boost::system_error or using standalone asio and std::system_error the * code will be passed through natively. * * In the case of a mismatch (boost::asio with std::system_error) a - * translated code will be returned. The plain socket policy does not have + * translated code will be returned. The plain socket policy does not have * any additional information so all such errors will be reported as the * generic transport pass_through error. * @@ -284,8 +283,8 @@ class connection : public lib::enable_shared_from_this { // We don't know any more information about this error so pass through return make_error_code(transport::error::pass_through); } - - /// Overload of translate_ec to catch cases where lib::error_code is the + + /// Overload of translate_ec to catch cases where lib::error_code is the /// same type as lib::asio::error_code lib::error_code translate_ec(lib::error_code ec) { // We don't know any more information about this error, but the error is diff --git a/src/plugins/server/3rdparty/include/websocketpp/transport/asio/security/tls.hpp b/src/plugins/server/3rdparty/include/websocketpp/transport/asio/security/tls.hpp index 7b32db814..40e52f328 100644 --- a/src/plugins/server/3rdparty/include/websocketpp/transport/asio/security/tls.hpp +++ b/src/plugins/server/3rdparty/include/websocketpp/transport/asio/security/tls.hpp @@ -193,8 +193,7 @@ class connection : public lib::enable_shared_from_this { if (!m_context) { return socket::make_error_code(socket::error::invalid_tls_context); } - m_socket = lib::make_shared( - _WEBSOCKETPP_REF(*service),lib::ref(*m_context)); + m_socket.reset(new socket_type(*service, *m_context)); m_io_service = service; m_strand = strand; @@ -229,7 +228,7 @@ class connection : public lib::enable_shared_from_this { * @param callback Handler to call back with completion information */ void pre_init(init_handler callback) { - // TODO: is this the best way to check whether this function is + // TODO: is this the best way to check whether this function is // available in the version of OpenSSL being used? // TODO: consider case where host is an IP address #if OPENSSL_VERSION_NUMBER >= 0x90812f @@ -368,11 +367,11 @@ class connection : public lib::enable_shared_from_this { return make_error_code(transport::error::pass_through); } } - + /// Overload of translate_ec to catch cases where lib::error_code is the /// same type as lib::asio::error_code lib::error_code translate_ec(lib::error_code ec) { - // Normalize the tls_short_read error as it is used by the library and + // Normalize the tls_short_read error as it is used by the library and // needs a consistent value. All other errors pass through natively. // TODO: how to get the SSL category from std::error? /*if (ec.category() == lib::asio::error::get_ssl_category()) {