From 21eb1bbd35cc9c423c9b97219e5bca0ca5da5e9b Mon Sep 17 00:00:00 2001 From: Peter Thorson Date: Sun, 6 Jan 2013 08:49:36 -0600 Subject: [PATCH] adds a convenience function to retrieve connection pointers from handles --- websocketpp/endpoint.hpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/websocketpp/endpoint.hpp b/websocketpp/endpoint.hpp index bb6ce14d22..a29bc159b9 100644 --- a/websocketpp/endpoint.hpp +++ b/websocketpp/endpoint.hpp @@ -141,7 +141,17 @@ protected: connection_ptr create_connection(); void remove_connection(connection_ptr con); - + + /// Retrieves a connection_ptr from a connection_hdl + /** + * @param hdl The connection handle to translate + * + * @return the connection_ptr. May be NULL if the handle was invalid. + */ + connection_ptr get_con_from_hdl(connection_hdl hdl) { + return lib::static_pointer_cast(hdl.lock()); + } + // protected resources mutex_type m_mutex; private: