Struct tls_listener::Builder
source · pub struct Builder<T> { /* private fields */ }
Expand description
Builder for TlsListener
.
Implementations§
source§impl<T> Builder<T>
impl<T> Builder<T>
sourcepub fn accept_batch_size(&mut self, size: NonZeroUsize) -> &mut Self
pub fn accept_batch_size(&mut self, size: NonZeroUsize) -> &mut Self
Set the size of batches of incoming connections to accept at once
When polling for a new connection, the TlsListener
will first check
for incomming connections on the listener that need to start a TLS handshake.
This specifies the maximum number of connections it will accept before seeing if any
TLS connections are ready.
Having a limit for this ensures that ready TLS conections aren’t starved if there are a large number of incoming connections.
Defaults to DEFAULT_ACCEPT_BATCH_SIZE
.
sourcepub fn handshake_timeout(&mut self, timeout: Duration) -> &mut Self
pub fn handshake_timeout(&mut self, timeout: Duration) -> &mut Self
Set the timeout for handshakes.
If a timeout takes longer than timeout
, then the handshake will be
aborted and the underlying connection will be dropped.
The default is fairly conservative, to avoid dropping connections. It is recommended that you adjust this to meet the specific needs of your use case in production deployments.
Defaults to DEFAULT_HANDSHAKE_TIMEOUT
.
sourcepub fn listen<A: AsyncAccept>(&self, listener: A) -> TlsListener<A, T>where
T: AsyncTls<A::Connection>,
pub fn listen<A: AsyncAccept>(&self, listener: A) -> TlsListener<A, T>where
T: AsyncTls<A::Connection>,
Create a TlsListener
from the builder
Actually build the TlsListener
. The listener
argument should be
an implementation of the AsyncAccept
trait that accepts new connections
that the TlsListener
will encrypt using TLS.