pass better information about TLS handshake failures

This commit is contained in:
Peter Thorson
2014-03-03 17:09:55 -06:00
parent 840bb6b59e
commit 5e2fadd826
2 changed files with 10 additions and 6 deletions

View File

@@ -95,7 +95,10 @@ namespace error {
pass_through,
/// Required tls_init handler not present
missing_tls_init_handler
missing_tls_init_handler,
/// TLS Handshake Failed
tls_handshake_failed,
};
} // namespace error
@@ -119,9 +122,11 @@ public:
case error::tls_handshake_timeout:
return "TLS handshake timed out";
case error::pass_through:
return "Pass through from underlying library";
return "Pass through from socket policy";
case error::missing_tls_init_handler:
return "Required tls_init handler not present.";
case error::tls_handshake_failed:
return "TLS handshake failed";
default:
return "Unknown";
}

View File

@@ -260,11 +260,10 @@ protected:
m_hdl = hdl;
}
void handle_init(init_handler callback, const
boost::system::error_code& ec)
void handle_init(init_handler callback,boost::system::error_code const & ec)
{
if (ec) {
m_ec = socket::make_error_code(socket::error::pass_through);
m_ec = socket::make_error_code(socket::error::tls_handshake_failed);
} else {
m_ec = lib::error_code();
}
@@ -284,7 +283,7 @@ protected:
void async_shutdown(socket_shutdown_handler callback) {
m_socket->async_shutdown(callback);
}
/// Translate any security policy specific information about an error code
/**
* Translate_ec takes a boost error code and attempts to convert its value