Skip to main content

patch_seq_tls_client

Function patch_seq_tls_client 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn patch_seq_tls_client(stack: Stack) -> Stack
Expand description

Upgrade a connected Socket to TLS.

Stack effect: ( Socket String -- Socket Bool ) — top of stack is the hostname (String), with the existing TCP socket id beneath it. On success, returns (socket_id, true) where socket_id is the same id the caller passed in: the registry slot is upgraded in place from Tcp to Tls, so any caller-side data structures keyed on the socket id remain valid. On failure (empty hostname, type mismatch, wrong-kind socket, handshake error, no slot found), returns (0, false); on the failure paths that already took the stream out of the registry, the underlying socket is closed (the TcpStream is dropped) and the slot is freed.

§Safety

Stack must have a String (hostname) on top of a Socket (Int).