Move peer state to a separate file
This commit is contained in:
parent
0d85eb9f2a
commit
1e478aabac
5 changed files with 33 additions and 23 deletions
24
crates/librqbit/src/peer_state.rs
Normal file
24
crates/librqbit/src/peer_state.rs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
use std::{collections::HashSet, net::SocketAddr, sync::Arc};
|
||||
|
||||
use tokio::sync::{Notify, Semaphore};
|
||||
|
||||
use crate::{torrent_state::InflightRequest, type_aliases::BF};
|
||||
|
||||
pub enum PeerState {
|
||||
Connecting(SocketAddr),
|
||||
Live(LivePeerState),
|
||||
}
|
||||
|
||||
pub struct LivePeerState {
|
||||
#[allow(unused)]
|
||||
pub peer_id: [u8; 20],
|
||||
pub i_am_choked: bool,
|
||||
#[allow(unused)]
|
||||
pub peer_choked: bool,
|
||||
#[allow(unused)]
|
||||
pub peer_interested: bool,
|
||||
pub outstanding_requests: Arc<Semaphore>,
|
||||
pub have_notify: Arc<Notify>,
|
||||
pub bitfield: Option<BF>,
|
||||
pub inflight_requests: HashSet<InflightRequest>,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue