This commit is contained in:
Igor Katson 2021-06-28 14:58:53 +01:00
parent 5a075c8ef3
commit 5f8100ebad
3 changed files with 17 additions and 34 deletions

View file

@ -12,9 +12,8 @@ pub enum PeerState {
pub struct LivePeerState {
pub peer_id: [u8; 20],
pub i_am_choked: bool,
pub peer_choked: bool,
pub peer_interested: bool,
pub outstanding_requests: Arc<Semaphore>,
pub requests_sem: Arc<Semaphore>,
pub have_notify: Arc<Notify>,
pub bitfield: Option<BF>,
pub inflight_requests: HashSet<InflightRequest>,
@ -25,11 +24,10 @@ impl LivePeerState {
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)),
requests_sem: Arc::new(Semaphore::new(0)),
inflight_requests: Default::default(),
}
}