Struct blaze_ssl_async::stream::BlazeListener
source · pub struct BlazeListener { /* private fields */ }Expand description
Listener wrapping TcpListener in order to accept SSL connections
Implementations§
source§impl BlazeListener
impl BlazeListener
sourcepub fn set_server_data(&mut self, data: Arc<BlazeServerData>)
pub fn set_server_data(&mut self, data: Arc<BlazeServerData>)
Replaces the server private key and certificate used for accepting connections
Arguments
- data - The new server data
sourcepub async fn bind<A: ToSocketAddrs>(addr: A) -> Result<BlazeListener>
pub async fn bind<A: ToSocketAddrs>(addr: A) -> Result<BlazeListener>
Binds a new TcpListener wrapping it in a BlazeListener if no errors occurred
Arguments
- addr - The addr(s) to attempt to bind on
sourcepub async fn accept(&self) -> Result<BlazeAccept>
pub async fn accept(&self) -> Result<BlazeAccept>
Accepts a new TcpStream from the underlying listener wrapping it in a server BlazeStream returning the wrapped stream and the stream addr.
Awaiting the blaze stream creation here would mean connections
wouldnt be able to be accepted so instead a BlazeAccept is returned
and finish_accept should be called within a spawned task otherwise
you can use blocking_accept to do an immediate handle
sourcepub async fn blocking_accept(
&self
) -> Result<(BlazeStream, SocketAddr), BlazeError>
pub async fn blocking_accept( &self ) -> Result<(BlazeStream, SocketAddr), BlazeError>
Alternative to accpet where the handshaking process is done straight away rather than in the BlazeAccept, this will prevent new connections from being accepted until the current handshake is complete