Function s2n_quic::provider::tls::default::ffi::s2n_shutdown_send

source ·
pub unsafe extern "C" fn s2n_shutdown_send(
    conn: *mut s2n_connection,
    blocked: *mut u32
) -> i32
Expand description

Attempts to close the write side of the TLS connection.

TLS1.3 supports closing the write side of a TLS connection while leaving the read side unaffected. This feature is usually referred to as “half-close”. We send a close_notify alert, but do not wait for the peer to respond.

Like s2n_shutdown(), this method does not affect the underlying transport.

s2n_shutdown_send() may still be called for earlier TLS versions, but most TLS implementations will react by immediately discarding any pending writes and closing the connection.

Once s2n_shutdown_send() is complete:

  • The s2n_connection handle CANNOT be used for writing.
  • The s2n_connection handle CAN be used for reading.
  • The write side of the underlying transport can be closed. Most likely via shutdown().

The application should still call s2n_shutdown() or wait for s2n_recv() to return 0 to indicate end-of-data before cleaning up the connection or closing the read side of the underlying transport.

@param conn A pointer to the s2n_connection object @param blocked A pointer which will be set to the blocked status if an S2N_ERR_T_BLOCKED error is returned. @returns S2N_SUCCESS on success. S2N_FAILURE on failure