Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
static bool do_connect(SSL *ssl, int &SSL_res, interval_t *timeout) throw() {
if(!SSL_set_tlsext_host_name(ssl, "example.com")) {
log_openssl_error(log::error);
throw exception_log_t(log::error, "SSL_sni");
}
SSL_set_connect_state(ssl);
while(true) {
int res = SSL_connect(ssl);
if(res > 0) return true;
else
if(ssl_wait_loop(ssl, res, SSL_res, timeout) < 0)
break;
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment