]> Repositorios git - scryer-prolog.git/commit
tls: release connection state on close and cache ServerConfig js/fixes origin/js/fixes
authorJavier Sagredo <[email protected]>
Sun, 31 May 2026 23:40:01 +0000 (01:40 +0200)
committerJavier Sagredo <[email protected]>
Sun, 31 May 2026 23:40:01 +0000 (01:40 +0200)
commit52d70bcb6abea4157746375ce26741fe63b0db82
tree677824d7b9ea9fa827562f3f898ea71462191df4
parent840a56ffe935eaa0b8f3c7a79719f3dcad3e74e2
tls: release connection state on close and cache ServerConfig

Closing a TLS or TCP stream previously only shut down the socket /
sent close_notify without dropping the arena-allocated payload, so the
rustls ServerConnection (and its buffers) lingered until the arena was
garbage-collected. For a server negotiating a fresh TLS connection per
request, this caused resident memory to climb steadily. Call
drop_payload() in Stream::close for the NamedTcp and NamedTls variants
so the underlying resources are freed immediately, matching the file,
byte and pipe stream variants.

Additionally, tls_accept_client rebuilt a ServerConfig on every
connection, re-parsing the certificate chain and private key each time.
Cache the most recently built config keyed by the raw cert/key bytes
and reuse it, avoiding the repeated parse and allocation.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
src/machine/streams.rs
src/machine/system_calls.rs