Shuts down the SSL connection and
prepares it for another connection.
static VALUE
ossl_ssl_close(VALUE self)
{
SSL *ssl;
VALUE io;
/* ossl_ssl_data_get_struct() is not usable here because it may return
* from this function; */
Data_Get_Struct(self, SSL, ssl);
io = ossl_ssl_get_io(self);
if (!RTEST(rb_funcall(io, rb_intern("closed?"), 0))) {
if (ssl) {
ossl_ssl_shutdown(ssl);
SSL_free(ssl);
}
DATA_PTR(self) = NULL;
if (RTEST(ossl_ssl_get_sync_close(self)))
rb_funcall(io, rb_intern("close"), 0);
}
return Qnil;
}