Tls module

close

procedureextensionexperimentalSource

Ends the stream: sends close_notify (unless now, which does not wait and sends nothing) and closes the connection under it, which wakes fibers still waiting on it with .CLOSED. The stream is freed once those fibers have left, so it must not be used after close; close it once.

Example↗
finish :: (stream: *Tls_Stream) {
    close(stream); // sends close_notify, closes the TCP connection, frees the stream
}

This one is only checked to compile, not run.

close :: (stream: *Tls_Stream, now := false) -> Io.Io_Error

Ends the stream: sends close_notify (unless now, which does not wait and sends nothing) and closes the connection under it, which wakes fibers still waiting on it with .CLOSED. The stream is freed once those fibers have left, so it must not be used after close; close it once.

Parameters

stream: *Tls_Stream
the stream to end.
now := false
skip close_notify and the wait; just close the connection.

Returns

Example↗
finish :: (stream: *Tls_Stream) {
    close(stream); // sends close_notify, closes the TCP connection, frees the stream
}

This one is only checked to compile, not run.

See also