adds a machine readable internal error code

To be used for storing detailed error codes for why connections failed
or were closed
This commit is contained in:
Peter Thorson
2013-06-08 10:38:01 -05:00
parent 4a94a7c518
commit 196523ba42

View File

@@ -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;