mirror of
https://github.com/transmission/transmission
synced 2025-03-15 16:29:34 +00:00
better saving of run/stopped state.
This commit is contained in:
parent
df1dce9b2a
commit
64faed5c47
3 changed files with 8 additions and 1 deletions
|
@ -272,7 +272,10 @@ tr_fastResumeSave( const tr_torrent_t * tor )
|
|||
|
||||
if( TRUE ) /* FR_ID_RUN */
|
||||
{
|
||||
const char is_running = (tor->runStatus == TR_RUN_RUNNING) ? 't' : 'f';
|
||||
const int run = tor->runStatusToSave>=0
|
||||
? tor->runStatusToSave
|
||||
: tor->runStatus;
|
||||
const char is_running = (run == TR_RUN_RUNNING) ? 't' : 'f';
|
||||
fastResumeWriteData( FR_ID_RUN, &is_running, 1, 1, file );
|
||||
}
|
||||
|
||||
|
|
|
@ -141,6 +141,7 @@ struct tr_torrent_s
|
|||
volatile char dieFlag;
|
||||
struct tr_bitfield_s * uncheckedPieces;
|
||||
run_status_t runStatus;
|
||||
run_status_t runStatusToSave;
|
||||
cp_status_t cpStatus;
|
||||
struct tr_thread_s * thread;
|
||||
struct tr_rwlock_s * lock;
|
||||
|
|
|
@ -249,6 +249,8 @@ torrentRealInit( tr_handle_t * h,
|
|||
tor->hasChangedState = -1;
|
||||
tor->pexDisabled = 0;
|
||||
|
||||
tor->runStatusToSave = -1;
|
||||
|
||||
/**
|
||||
* Decide on a block size. constraints:
|
||||
* (1) most clients decline requests over 16 KiB
|
||||
|
@ -1081,6 +1083,7 @@ void tr_torrentStop( tr_torrent_t * tor )
|
|||
|
||||
void tr_torrentClose( tr_torrent_t * tor )
|
||||
{
|
||||
tor->runStatusToSave = tor->runStatus;
|
||||
tr_torrentStop( tor );
|
||||
tor->dieFlag = TRUE;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue