From b408ab876e4d763a07736eb42f0c9174ce937820 Mon Sep 17 00:00:00 2001 From: Peter Thorson Date: Tue, 7 May 2013 20:45:28 -0500 Subject: [PATCH] adds method to set proxy timeout duration at runtime --- websocketpp/transport/asio/connection.hpp | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/websocketpp/transport/asio/connection.hpp b/websocketpp/transport/asio/connection.hpp index feaf63a011..f1ad0d4f64 100644 --- a/websocketpp/transport/asio/connection.hpp +++ b/websocketpp/transport/asio/connection.hpp @@ -186,7 +186,31 @@ public: if (ec) { throw ec; } } + /// Set the proxy timeout duration (exception free) + /** + * Duration is in milliseconds. Default value is based on the transport + * config + * + * @param duration The number of milliseconds to wait before aborting the + * proxy connection. + * + * @param ec A status value + */ + void set_proxy_timeout(long duration, lib::error_code & ec) { + if (!m_proxy_data) { + ec = make_error_code(websocketpp::error::invalid_state); + return; } + + m_proxy_data->timeout_proxy = duration; + ec = lib::error_code(); + } + + /// Set the proxy timeout duration (exception) + void set_proxy_timeout(long duration) { + lib::error_code ec; + set_proxy_timeout(duration,ec); + if (ec) { throw ec; } } const std::string & get_proxy() const {