From 196523ba42756b8ff33bbe3328f4cbcc5565e52e Mon Sep 17 00:00:00 2001 From: Peter Thorson Date: Sat, 8 Jun 2013 10:38:01 -0500 Subject: [PATCH] adds a machine readable internal error code To be used for storing detailed error codes for why connections failed or were closed --- websocketpp/connection.hpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/websocketpp/connection.hpp b/websocketpp/connection.hpp index 409686ad5f..c212d2a77f 100644 --- a/websocketpp/connection.hpp +++ b/websocketpp/connection.hpp @@ -775,6 +775,19 @@ public: */ session::state::value get_state() const; + /// Get the internal error code for a closed/failed connection + /** + * Retrieves a machine readable detailed error code indicating the reason + * that the connection was closed or failed. Valid only after the close or + * fail handler is called. + * + * @return Error code indicating the reason the connection was closed or + * failed + */ + lib::error_code get_ec() const { + return m_ec; + } + //////////////////////////////////////////////////////////////////////// // The remaining public member functions are for internal/policy use // // only. Do not call from application code unless you understand what // @@ -1117,6 +1130,9 @@ private: /// Close reason that was received on the wire from the remote endpoint std::string m_remote_close_reason; + /// Detailed internal error code + lib::error_code m_ec; + /// Whether or not this endpoint initiated the closing handshake. bool m_closed_by_me;