mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
udp: log (info-level) estimated channel memory use
This commit is contained in:
parent
8ad799042e
commit
c4e644cb23
2 changed files with 32 additions and 1 deletions
|
|
@ -2,6 +2,7 @@ use std::borrow::Cow;
|
|||
use std::collections::BTreeMap;
|
||||
use std::hash::Hash;
|
||||
use std::io::Write;
|
||||
use std::mem::size_of;
|
||||
use std::net::{SocketAddr, SocketAddrV4};
|
||||
use std::sync::atomic::AtomicUsize;
|
||||
use std::sync::Arc;
|
||||
|
|
@ -101,6 +102,15 @@ pub struct ConnectedResponseWithAddr {
|
|||
pub addr: CanonicalSocketAddr,
|
||||
}
|
||||
|
||||
impl ConnectedResponseWithAddr {
|
||||
pub fn estimated_max_size(config: &Config) -> usize {
|
||||
size_of::<Self>()
|
||||
+ config.protocol.max_response_peers
|
||||
* (size_of::<ResponsePeer<Ipv4AddrBytes>>()
|
||||
+ size_of::<ResponsePeer<Ipv6AddrBytes>>())
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Recycler;
|
||||
|
||||
impl thingbuf::Recycle<ConnectedResponseWithAddr> for Recycler {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue