Skip to content

Commit b333aa4

Browse files
authored
fix(benches): use session ticket for resumption (#5305)
1 parent 7d2102f commit b333aa4

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

bindings/rust/standard/bench/benches/handshake.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,19 @@ fn bench_handshake_for_library<T>(
2121
T: TlsConnection,
2222
T::Config: TlsBenchConfig,
2323
{
24-
// make configs before benching to reuse
2524
let crypto_config = CryptoConfig::new(CipherSuite::default(), kx_group, sig_type);
26-
let client_config =
27-
T::Config::make_config(Mode::Client, crypto_config, handshake_type).unwrap();
28-
let server_config =
29-
T::Config::make_config(Mode::Server, crypto_config, handshake_type).unwrap();
3025

3126
// generate all harnesses (TlsConnPair structs) beforehand so that benchmarks
3227
// only include negotiation and not config/connection initialization
3328
bench_group.bench_function(T::name(), |b| {
3429
b.iter_batched_ref(
35-
|| -> TlsConnPair<T, T> { TlsConnPair::from_configs(&client_config, &server_config) },
30+
|| -> TlsConnPair<T, T> { TlsConnPair::new_bench_pair(crypto_config, handshake_type).unwrap() },
3631
|conn_pair| {
3732
conn_pair.handshake().unwrap();
33+
match handshake_type {
34+
HandshakeType::ServerAuth | HandshakeType::MutualAuth => assert!(!conn_pair.server.resumed_connection()),
35+
HandshakeType::Resumption => assert!(conn_pair.server.resumed_connection()),
36+
}
3837
},
3938
BatchSize::SmallInput,
4039
)

0 commit comments

Comments
 (0)