vm-migration, vmm: Remove unsafe code when setting socket options

The introduced `TcpStream` accessor allows setting socket options on the
`TcpStream` without going through the file descriptor and unsafe
methods.

On-behalf-of: SAP julian.schindel@sap.com
Signed-off-by: Julian Schindel <julian.schindel@cyberus-technology.de>
This commit is contained in:
Julian Schindel
2026-07-28 15:57:09 +02:00
committed by Rob Bradford
parent 53ee9ebb77
commit ec68508a2a
2 changed files with 12 additions and 20 deletions

View File

@@ -216,6 +216,14 @@ impl TlsStream {
/// from growing without bound.
const BUF_SIZE: usize = 64 /* KiB */ << 10;
/// Returns a reference to the underlying [`TcpStream`].
pub fn tcp_stream(&self) -> &TcpStream {
match &self.stream {
TlsStreamParticipant::Client(stream) => stream.get_ref(),
TlsStreamParticipant::Server(stream) => stream.get_ref(),
}
}
/// Creates a client [`TlsStream`].
///
/// The client verifies the server certificate against `ca-cert.pem` and the