Skip to content
Browse files

Minor code cleanup before PAUSE

  • Loading branch information...
1 parent 9b786db commit fc6b65c48b0611dfb9c0b916e2653d63ed4477ed @sanko committed Jul 11, 2012
Showing with 18 additions and 14 deletions.
  1. +4 −1 Changes
  2. +1 −0 TODO
  3. +12 −12 lib/AnyEvent/BitTorrent.pm
  4. +1 −1 t/000_tests/001_global.t
View
5 Changes
@@ -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( )
View
1 TODO
@@ -1,3 +1,4 @@
Everything marked with XXX in /lib/AnyEvent/BitTorrent.pm
Fast Ext.
API for file download priority
+IPv6 trackers
View
24 lib/AnyEvent/BitTorrent.pm
@@ -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(
@@ -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
View
2 t/000_tests/001_global.t
@@ -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(

0 comments on commit fc6b65c

Please sign in to comment.
Something went wrong with that request. Please try again.