Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

According to BEP06, CHOKE does not imply that pending reqs were rejected

  • Loading branch information...
commit c9e65dfea1bc0d0f5f622848b9dcb731b8f97d59 1 parent 7073c71
@sanko authored
Showing with 6 additions and 4 deletions.
  1. +6 −4 lib/AnyEvent/BitTorrent.pm
View
10 lib/AnyEvent/BitTorrent.pm
@@ -774,10 +774,12 @@ sub _on_read {
}
elsif ($packet->{type} == $CHOKE) {
$s->peers->{$h}{local_choked} = 1;
- for my $req (@{$s->peers->{$h}{local_requests}}) {
- $s->working_pieces->{$req->[0]}{$req->[1]}[3] = ()
- unless
- defined $s->working_pieces->{$req->[0]}{$req->[1]}[4];
+ if (!(vec($s->peers->{$h}{reserved}, 7, 1) & 0x04)) {
+ for my $req (@{$s->peers->{$h}{local_requests}}) {
+ $s->working_pieces->{$req->[0]}{$req->[1]}[3] = ()
+ unless
+ defined $s->working_pieces->{$req->[0]}{$req->[1]}[4];
+ }
}
$s->_consider_peer($s->peers->{$h});
}
Please sign in to comment.
Something went wrong with that request. Please try again.