mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-15 13:46:17 +00:00
Fix fast resume script breaking single file torrents (See #7)
This commit is contained in:
@@ -85,7 +85,7 @@ foreach my $f (0..$#files) {
|
|||||||
my $mtime = (stat "$d$files[$f]")[9];
|
my $mtime = (stat "$d$files[$f]")[9];
|
||||||
|
|
||||||
# Compute number of chunks per file
|
# Compute number of chunks per file
|
||||||
my $fsize = $t->{info}{files}[$f]{length};
|
my $fsize = (exists $t->{info}{files}) ? $t->{info}{files}[$f]{length} : 1;
|
||||||
my $fchunks = ($pmod ? 1 : 0);
|
my $fchunks = ($pmod ? 1 : 0);
|
||||||
if ($pmod >= $fsize) { ($fsize, $pmod ) = (0, $pmod-$fsize); }
|
if ($pmod >= $fsize) { ($fsize, $pmod ) = (0, $pmod-$fsize); }
|
||||||
else { ($pmod, $fsize) = (0, $fsize-$pmod); }
|
else { ($pmod, $fsize) = (0, $fsize-$pmod); }
|
||||||
@@ -101,7 +101,10 @@ foreach my $f (0..$#files) {
|
|||||||
$t->{libtorrent_resume}{'uncertain_pieces.timestamp'} = time;
|
$t->{libtorrent_resume}{'uncertain_pieces.timestamp'} = time;
|
||||||
|
|
||||||
# Some extra information to re-enforce the fact that this is a finished torrent
|
# Some extra information to re-enforce the fact that this is a finished torrent
|
||||||
|
if (exists $t->{info}{files}) {
|
||||||
$d .= $t->{info}{name};
|
$d .= $t->{info}{name};
|
||||||
|
}
|
||||||
|
|
||||||
$t->{rtorrent} = {
|
$t->{rtorrent} = {
|
||||||
state => 1, # started
|
state => 1, # started
|
||||||
state_changed => time,
|
state_changed => time,
|
||||||
|
|||||||
Reference in New Issue
Block a user