mirror of
https://github.com/transmission/transmission
synced 2024-12-25 09:13:06 +00:00
Fixes #22 (all torrents apparently at 0 % when T restarts)
This commit is contained in:
parent
4d20e5c525
commit
cca3cab9fc
3 changed files with 26 additions and 0 deletions
|
@ -60,6 +60,29 @@ static void findSlotForPiece( tr_io_t *, int );
|
||||||
#define readSlot(io,sl,b,s) readOrWriteSlot(io,sl,b,s,0)
|
#define readSlot(io,sl,b,s) readOrWriteSlot(io,sl,b,s,0)
|
||||||
#define writeSlot(io,sl,b,s) readOrWriteSlot(io,sl,b,s,1)
|
#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
|
* tr_ioInit
|
||||||
***********************************************************************
|
***********************************************************************
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
|
|
||||||
typedef struct tr_io_s tr_io_t;
|
typedef struct tr_io_s tr_io_t;
|
||||||
|
|
||||||
|
void tr_ioLoadResume ( tr_torrent_t * );
|
||||||
|
|
||||||
tr_io_t * tr_ioInit ( tr_torrent_t * );
|
tr_io_t * tr_ioInit ( tr_torrent_t * );
|
||||||
int tr_ioRead ( tr_io_t *, int, int, int, uint8_t * );
|
int tr_ioRead ( tr_io_t *, int, int, int, uint8_t * );
|
||||||
int tr_ioWrite ( tr_io_t *, int, int, int, uint8_t * );
|
int tr_ioWrite ( tr_io_t *, int, int, int, uint8_t * );
|
||||||
|
|
|
@ -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 )
|
void tr_torrentSetFolder( tr_torrent_t * tor, const char * path )
|
||||||
{
|
{
|
||||||
tor->destination = strdup( path );
|
tor->destination = strdup( path );
|
||||||
|
tr_ioLoadResume( tor );
|
||||||
}
|
}
|
||||||
|
|
||||||
char * tr_torrentGetFolder( tr_torrent_t * tor )
|
char * tr_torrentGetFolder( tr_torrent_t * tor )
|
||||||
|
|
Loading…
Reference in a new issue