Skip to content

Commit 8abba36

Browse files
rushilmehraghedo
authored andcommitted
Ssl::new_from_ref -> Ssl::new()
1 parent 0fc992b commit 8abba36

File tree

1 file changed

+2
-21
lines changed

1 file changed

+2
-21
lines changed

boring/src/ssl/mod.rs

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2749,32 +2749,13 @@ impl Ssl {
27492749
}
27502750
}
27512751

2752-
/// Creates a new `Ssl`.
2753-
///
2754-
// FIXME should take &SslContextRef
2755-
#[corresponds(SSL_new)]
2756-
pub fn new(ctx: &SslContext) -> Result<Ssl, ErrorStack> {
2757-
unsafe {
2758-
let ptr = cvt_p(ffi::SSL_new(ctx.as_ptr()))?;
2759-
let mut ssl = Ssl::from_ptr(ptr);
2760-
ssl.set_ex_data(*SESSION_CTX_INDEX, ctx.clone());
2761-
2762-
Ok(ssl)
2763-
}
2764-
}
2765-
27662752
/// Creates a new [`Ssl`].
2767-
///
2768-
/// This function does the same as [`Self:new`] except that it takes &[SslContextRef].
2769-
// Both functions exist for backward compatibility (no breaking API).
27702753
#[corresponds(SSL_new)]
2771-
pub fn new_from_ref(ctx: &SslContextRef) -> Result<Ssl, ErrorStack> {
2754+
pub fn new(ctx: &SslContextRef) -> Result<Ssl, ErrorStack> {
27722755
unsafe {
27732756
let ptr = cvt_p(ffi::SSL_new(ctx.as_ptr()))?;
27742757
let mut ssl = Ssl::from_ptr(ptr);
2775-
SSL_CTX_up_ref(ctx.as_ptr());
2776-
let ctx_owned = SslContext::from_ptr(ctx.as_ptr());
2777-
ssl.set_ex_data(*SESSION_CTX_INDEX, ctx_owned);
2758+
ssl.set_ex_data(*SESSION_CTX_INDEX, ctx.to_owned());
27782759

27792760
Ok(ssl)
27802761
}

0 commit comments

Comments
 (0)