Updating visilibity little by little
This commit is contained in:
parent
1e478aabac
commit
c6cf9776d1
2 changed files with 17 additions and 11 deletions
|
|
@ -11,7 +11,7 @@ pub enum PeerState {
|
|||
|
||||
pub struct LivePeerState {
|
||||
#[allow(unused)]
|
||||
pub peer_id: [u8; 20],
|
||||
peer_id: [u8; 20],
|
||||
pub i_am_choked: bool,
|
||||
#[allow(unused)]
|
||||
pub peer_choked: bool,
|
||||
|
|
@ -22,3 +22,18 @@ pub struct LivePeerState {
|
|||
pub bitfield: Option<BF>,
|
||||
pub inflight_requests: HashSet<InflightRequest>,
|
||||
}
|
||||
|
||||
impl LivePeerState {
|
||||
pub fn new(peer_id: [u8; 20]) -> Self {
|
||||
LivePeerState {
|
||||
peer_id: peer_id,
|
||||
i_am_choked: true,
|
||||
peer_choked: true,
|
||||
peer_interested: false,
|
||||
bitfield: None,
|
||||
have_notify: Arc::new(Notify::new()),
|
||||
outstanding_requests: Arc::new(Semaphore::new(0)),
|
||||
inflight_requests: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue