pub struct UploadSession {
pub peer_addr: SocketAddr,
pub uploaded_bytes: u64,
pub upload_speed: u64,
pub last_upload_time: Instant,
pub is_active: bool,
}Expand description
Represents an active upload session with a peer.
Tracks upload statistics and session state for a single peer connection during the seeding phase.
Fields§
§peer_addr: SocketAddrPeer’s socket address
uploaded_bytes: u64Bytes uploaded to this peer in the current session
upload_speed: u64Upload speed in bytes/sec (rolling average)
last_upload_time: InstantLast time data was uploaded to this peer
is_active: boolWhether this session is active
Implementations§
Source§impl UploadSession
impl UploadSession
Sourcepub fn new(peer_addr: SocketAddr) -> Self
pub fn new(peer_addr: SocketAddr) -> Self
Create a new upload session for a peer.
Sourcepub fn record_upload(&mut self, bytes: u64)
pub fn record_upload(&mut self, bytes: u64)
Record bytes uploaded to this peer.
Sourcepub fn update_speed(&mut self, speed: u64)
pub fn update_speed(&mut self, speed: u64)
Update the upload speed (rolling average).
Sourcepub fn deactivate(&mut self)
pub fn deactivate(&mut self)
Mark this session as inactive.
Trait Implementations§
Source§impl Clone for UploadSession
impl Clone for UploadSession
Source§fn clone(&self) -> UploadSession
fn clone(&self) -> UploadSession
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for UploadSession
impl RefUnwindSafe for UploadSession
impl Send for UploadSession
impl Sync for UploadSession
impl Unpin for UploadSession
impl UnsafeUnpin for UploadSession
impl UnwindSafe for UploadSession
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