Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ jobs:
- run: |
cargo update -p unicode-ident --precise 1.0.22
cargo update -p syn --precise 2.0.114
cargo update -p once_cell --precise 1.20.3
cargo update -p wasip2 --precise 1.0.1+wasi-0.2.4
cargo update -p quote --precise 1.0.44
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
Expand Down
1 change: 1 addition & 0 deletions openssl/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Changed

* Bumped MSRV to 1.80.
* Removed the `once_cell` dependency in favor of `std::sync::{LazyLock, OnceLock}`.

### Added

Expand Down
1 change: 0 additions & 1 deletion openssl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ bitflags = "2.2.1"
cfg-if = "1.0"
foreign-types = "0.3.1"
libc = "0.2"
once_cell = "1.5.2"

openssl-macros = { version = "0.1.1", path = "../openssl-macros" }
ffi = { package = "openssl-sys", version = "0.9.114", path = "../openssl-sys" }
Expand Down
19 changes: 13 additions & 6 deletions openssl/src/ssl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ use bitflags::bitflags;
use cfg_if::cfg_if;
use foreign_types::{ForeignType, ForeignTypeRef, Opaque};
use libc::{c_char, c_int, c_long, c_uchar, c_uint, c_void};
use once_cell::sync::{Lazy, OnceCell};
use openssl_macros::corresponds;
use std::any::TypeId;
use std::collections::HashMap;
Expand All @@ -101,7 +100,7 @@ use std::panic::resume_unwind;
use std::path::Path;
use std::ptr;
use std::str;
use std::sync::{Arc, Mutex};
use std::sync::{Arc, LazyLock, Mutex, OnceLock};

pub use crate::ssl::connector::{
ConnectConfiguration, SslAcceptor, SslAcceptorBuilder, SslConnector, SslConnectorBuilder,
Expand Down Expand Up @@ -563,12 +562,20 @@ impl NameType {
}
}

static INDEXES: Lazy<Mutex<HashMap<TypeId, c_int>>> = Lazy::new(|| Mutex::new(HashMap::new()));
static SSL_INDEXES: Lazy<Mutex<HashMap<TypeId, c_int>>> = Lazy::new(|| Mutex::new(HashMap::new()));
static SESSION_CTX_INDEX: OnceCell<Index<Ssl, SslContext>> = OnceCell::new();
static INDEXES: LazyLock<Mutex<HashMap<TypeId, c_int>>> =
LazyLock::new(|| Mutex::new(HashMap::new()));
static SSL_INDEXES: LazyLock<Mutex<HashMap<TypeId, c_int>>> =
LazyLock::new(|| Mutex::new(HashMap::new()));
static SESSION_CTX_INDEX: OnceLock<Index<Ssl, SslContext>> = OnceLock::new();

fn try_get_session_ctx_index() -> Result<&'static Index<Ssl, SslContext>, ErrorStack> {
SESSION_CTX_INDEX.get_or_try_init(Ssl::new_ex_index)
// Once `OnceLock::get_or_try_init` (rust-lang/rust#109737) is stable, this
// can collapse to `SESSION_CTX_INDEX.get_or_try_init(Ssl::new_ex_index)`.
if let Some(idx) = SESSION_CTX_INDEX.get() {
return Ok(idx);
}
let new = Ssl::new_ex_index::<SslContext>()?;
Ok(SESSION_CTX_INDEX.get_or_init(|| new))
}

unsafe extern "C" fn free_data_box<T>(
Expand Down