pub struct ConnectionAcceptor<T, A> { /* private fields */ }Expand description
ConnectionAcceptor manages incoming connections with resource limits and lifecycle control.
This struct handles accepting new connections from the transport layer, limiting concurrent connections, and delegating each connection to a processor.
Generic parameters:
T: The acceptor type that accepts new connections from the transportA: The authenticator type that handles connection authentication
Implementations§
Source§impl<T: Acceptor, A: Authenticator<T::Connection> + 'static> ConnectionAcceptor<T, A>
impl<T: Acceptor, A: Authenticator<T::Connection> + 'static> ConnectionAcceptor<T, A>
Sourcepub fn new(acceptor: T, authenticator: A) -> Self
pub fn new(acceptor: T, authenticator: A) -> Self
Creates a new connection acceptor with the given acceptor and authenticator.
The acceptor will use default connection configuration if not provided.
Sourcepub fn with_config(
acceptor: T,
authenticator: A,
config: Arc<ConnectionConfig>,
) -> Self
pub fn with_config( acceptor: T, authenticator: A, config: Arc<ConnectionConfig>, ) -> Self
Creates a new connection acceptor with custom connection configuration.
Sourcepub async fn accept_loop(&self, shutdown_rx: Receiver<()>) -> Result<()>
pub async fn accept_loop(&self, shutdown_rx: Receiver<()>) -> Result<()>
Main accept loop that accepts incoming connections and manages them with resource limits.
This method will:
- Accept new connections from the acceptor
- Acquire a semaphore permit to limit total concurrent connections
- Spawn a task to handle each connection
- Gracefully handle shutdown signals
pub fn local_addr(&self) -> Result<SocketAddr>
Auto Trait Implementations§
impl<T, A> Freeze for ConnectionAcceptor<T, A>
impl<T, A> RefUnwindSafe for ConnectionAcceptor<T, A>where
T: RefUnwindSafe,
A: RefUnwindSafe,
impl<T, A> Send for ConnectionAcceptor<T, A>
impl<T, A> Sync for ConnectionAcceptor<T, A>
impl<T, A> Unpin for ConnectionAcceptor<T, A>
impl<T, A> UnsafeUnpin for ConnectionAcceptor<T, A>
impl<T, A> UnwindSafe for ConnectionAcceptor<T, A>where
T: RefUnwindSafe,
A: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more