Function s2n_tls_sys::s2n_peek

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

Allows users of s2n-tls to peek inside the data buffer of an s2n-tls connection to see if there more data to be read without actually reading it.

This is useful when using select() on the underlying s2n-tls file descriptor with a message based application layer protocol. As a single call to s2n_recv may read all data off the underlying file descriptor, select() will be unable to tell you there if there is more application data ready for processing already loaded into the s2n-tls buffer.

@note can then be used to determine if s2n_recv() needs to be called before more data comes in on the raw fd @param conn A pointer to the s2n_connection object @returns The number of bytes that can be read from the connection