Skip to content

Commit

Permalink
Minor code cleanup before PAUSE
Browse files Browse the repository at this point in the history
  • Loading branch information
sanko committed Jul 12, 2012
1 parent 9b786db commit fc6b65c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
5 changes: 4 additions & 1 deletion Changes
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
Version 0.1.7 | Next Sunday AD | xxxxxxxxxx
Version 0.1.7 | Early morning, July 12th, 2012 | xxxxxxxxxx

Protocol/Behavioral Changes:
* Small steps forward on IPv6 support

Documentation/Sample Code/Test Suite:
* Document $client->trackers( )
Expand Down
1 change: 1 addition & 0 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Everything marked with XXX in /lib/AnyEvent/BitTorrent.pm
Fast Ext.
API for file download priority
IPv6 trackers
24 changes: 12 additions & 12 deletions lib/AnyEvent/BitTorrent.pm
Original file line number Diff line number Diff line change
Expand Up @@ -559,14 +559,12 @@ sub _announce_tier {
$tier->{failures} = $tier->{'failure reason'} = 0;
$tier->{peers}
= compact_ipv4(
uncompact_ipv4($tier->{peers} . ($reply->{peers} || '')))
|| '';
$tier->{peers6} =
compact_ipv6(
uncompact_ipv6(
$tier->{peers6} . ($reply->{peers6} || '')
)
) || '';
uncompact_ipv4($tier->{peers} . $reply->{peers}))
if $reply->{peers};
$tier->{peers6}
= compact_ipv6(
uncompact_ipv6($tier->{peers6} . $reply->{peers6}))
if $reply->{peers6};
$tier->{complete} = $reply->{complete};
$tier->{incomplete} = $reply->{incomplete};
$tier->{ticker} = AE::timer(
Expand Down Expand Up @@ -670,10 +668,12 @@ sub _build_peer_timer {
return if !$s->_left;

# XXX - Initiate connections when we are in Super seed mode?
my @cache
= uncompact_ipv4(join '',
map { $_->{peers} } @{$s->trackers}),
uncompact_ipv6(join '', map { $_->{peers6} } @{$s->trackers});
my @cache = map {
$_->{peers} ? uncompact_ipv4($_->{peers}) : (),
$_->{peers6} ?
uncompact_ipv6($_->{peers6})
: ()
} @{$s->trackers};
return if !@cache;
for my $i (1 .. @cache) {
last if $i > 10; # XXX - Max half open
Expand Down
2 changes: 1 addition & 1 deletion t/000_tests/001_global.t
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ my $basedir = File::Temp::tempdir('AB_XXXX', TMPDIR => 1);
chdir '../..' if !-f $torrent;
my $cv = AE::cv;
my $client;
my $to = AE::timer(60, 0, sub { diag sprintf 'Timeout!'; $cv->send });
my $to = AE::timer(90, 0, sub { diag 'Timeout'; $cv->send });

#
$client = AnyEvent::BitTorrent->new(
Expand Down

0 comments on commit fc6b65c

Please sign in to comment.