Permalink
Browse files

ssl: c++: be verbose about SSL connection errors (#807)

  • Loading branch information...
1 parent e9f08d9 commit dcec4a7890d2cec53cbf397e9561ad7ef0f48b21 @zOrg1331 zOrg1331 committed with sodabrew Oct 5, 2017
Showing with 6 additions and 2 deletions.
  1. +6 −2 ext/ssl.cpp
View
@@ -345,8 +345,11 @@ SslBox_t::SslBox_t (bool is_server, const string &privkeyfile, const string &cer
SSL_set_verify(pSSL, mode, ssl_verify_wrapper);
}
- if (!bIsServer)
- SSL_connect (pSSL);
+ if (!bIsServer) {
+ int e = SSL_connect (pSSL);
+ if (e != 1)
+ ERR_print_errors_fp(stderr);
+ }
}
@@ -397,6 +400,7 @@ int SslBox_t::GetPlaintext (char *buf, int bufsize)
if (e != 1) {
int er = SSL_get_error (pSSL, e);
if (er != SSL_ERROR_WANT_READ) {
+ ERR_print_errors_fp(stderr);
// Return -1 for a nonfatal error, -2 for an error that should force the connection down.
return (er == SSL_ERROR_SSL) ? (-2) : (-1);
}

0 comments on commit dcec4a7

Please sign in to comment.