Pike v8.1 release 6

Method Protocols.Bittorrent.Torrent()->fix_targets()


Method fix_targets

int fix_targets(void|int(-1..2) allocate, void|string base_filename, void|function(int, int:void) progress_callback)

Description

Opens target datafile(s).

If all files are created, the verify info will be filled as well, but if it isn't created, a call to verify_target() is necessary after this call.

Parameter allocate

Determines allocation procedure if the file doesn't exist:

0

Don't allocate.

1

Allocate virtual file size (seek, write end byte).

2

Allocate for real (will call progress_callback(pos,length)).

-1

Means never create a file, only open old files.

Parameter my_filename

A new base filename to substitute the metainfo base target filename with.

Returns
1

The (a) file was already there.

2

All target files were created.