aquatic_ws: save peer even if AnnounceRequest.bytes_left is None

This commit is contained in:
Joakim Frostegård 2020-05-15 16:02:49 +02:00
parent 008d8b8eff
commit cb66364fa5
3 changed files with 34 additions and 36 deletions

View file

@ -37,11 +37,11 @@ impl PeerStatus {
#[inline]
pub fn from_event_and_bytes_left(
event: AnnounceEvent,
bytes_left: usize
opt_bytes_left: Option<usize>
) -> Self {
if let AnnounceEvent::Stopped = event {
Self::Stopped
} else if bytes_left == 0 {
} else if let Some(0) = opt_bytes_left {
Self::Seeding
} else {
Self::Leeching