
Hi Scott, Scott <cheesy4poofs@cox.net> wrote:
However, I'm still getting random lockups when I enable SSL. The problems may very well stem from our code, but I've spent so much wasted time trying to track it down I'm hoping someone might be able to shed some light on why this happens. [...] The asio::error object says "Access is denied".
The error is actually SSL_ERROR_SYSCALL (which is 5), and it's showing up as "access denied" because it's not getting mapped correctly. Can you try the changes to openssl_operation.hpp shown below and see what you get as the real error. Thanks. Cheers, Chris --------------------------------- @@ -25,6 +25,7 @@ #include "asio/buffer.hpp" #include "asio/placeholders.hpp" #include "asio/write.hpp" +#include "asio/detail/socket_ops.hpp" #include "asio/ssl/detail/openssl_types.hpp" namespace asio { @@ -141,6 +142,7 @@ int error_code = !is_operation_done ? ::SSL_get_error( session_, rc ) : 0; + int sys_error_code = asio::detail::socket_ops::get_error(); bool is_read_needed = (error_code == SSL_ERROR_WANT_READ); bool is_write_needed = (error_code == SSL_ERROR_WANT_WRITE || ::BIO_ctrl_pending( ssl_bio_ )); @@ -165,9 +167,14 @@ if (!is_operation_done && !is_read_needed && !is_write_needed && !is_shut_down_sent) + { // The operation has failed... It is not completed and does // not want network communication nor does want to send shutdown out... - return handler_(asio::error(error_code), rc); + if (error_code == SSL_ERROR_SYSCALL) + return handler_(asio::error(sys_error_code), rc); + else + return handler_(asio::error(error_code + 1000000), rc); + } if (!is_operation_done && !is_write_needed) {