pub struct ConnectionManager { /* private fields */ }Expand description
TCP connection management
Implementations§
Source§impl Manager
impl Manager
pub fn new(config: ConnectionConfig, stats_tx: Sender<StatEvent>) -> Self
Sourcepub async fn accept_connection(
self: &Arc<Self>,
addr: SocketAddr,
) -> Result<ConnectionGuard, RelayError>
pub async fn accept_connection( self: &Arc<Self>, addr: SocketAddr, ) -> Result<ConnectionGuard, RelayError>
Attempt to establish a new connection
pub async fn get_connection_count(&self, addr: &SocketAddr) -> usize
pub async fn get_total_connections(&self) -> usize
Sourcepub async fn record_request(
&self,
addr: SocketAddr,
success: bool,
duration: Duration,
)
pub async fn record_request( &self, addr: SocketAddr, success: bool, duration: Duration, )
Updates statistics for a given request
Sourcepub async fn get_stats(&self) -> Result<ConnectionStats, RelayError>
pub async fn get_stats(&self) -> Result<ConnectionStats, RelayError>
Gets complete connection statistics
pub fn stats_tx(&self) -> Sender<StatEvent>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Manager
impl !RefUnwindSafe for Manager
impl Send for Manager
impl Sync for Manager
impl Unpin for Manager
impl !UnwindSafe for Manager
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