1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-24 08:43:27 +00:00

Fixes #22 (all torrents apparently at 0 % when T restarts)

This commit is contained in:
Eric Petit 2006-06-13 00:28:03 +00:00
parent 4d20e5c525
commit cca3cab9fc
3 changed files with 26 additions and 0 deletions

View file

@ -60,6 +60,29 @@ static void findSlotForPiece( tr_io_t *, int );
#define readSlot(io,sl,b,s) readOrWriteSlot(io,sl,b,s,0)
#define writeSlot(io,sl,b,s) readOrWriteSlot(io,sl,b,s,1)
/***********************************************************************
* tr_ioLoadResume
***********************************************************************
* Try to load the fast resume file
**********************************************************************/
void tr_ioLoadResume( tr_torrent_t * tor )
{
tr_io_t * io;
tr_info_t * inf = &tor->info;
io = malloc( sizeof( tr_io_t ) );
io->tor = tor;
io->pieceSlot = malloc( inf->pieceCount * sizeof( int ) );
io->slotPiece = malloc( inf->pieceCount * sizeof( int ) );
fastResumeLoad( io );
free( io->pieceSlot );
free( io->slotPiece );
free( io );
}
/***********************************************************************
* tr_ioInit
***********************************************************************

View file

@ -27,6 +27,8 @@
typedef struct tr_io_s tr_io_t;
void tr_ioLoadResume ( tr_torrent_t * );
tr_io_t * tr_ioInit ( tr_torrent_t * );
int tr_ioRead ( tr_io_t *, int, int, int, uint8_t * );
int tr_ioWrite ( tr_io_t *, int, int, int, uint8_t * );

View file

@ -317,6 +317,7 @@ int tr_torrentScrape( tr_torrent_t * tor, int * s, int * l )
void tr_torrentSetFolder( tr_torrent_t * tor, const char * path )
{
tor->destination = strdup( path );
tr_ioLoadResume( tor );
}
char * tr_torrentGetFolder( tr_torrent_t * tor )