1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-12 23:23:54 +00:00

save the tr_torrent::pexDisabled flag in fastresume

This commit is contained in:
Charles Kerr 2007-10-15 16:35:18 +00:00
parent 963e5514c1
commit afff6d08f2
2 changed files with 25 additions and 1 deletions

View file

@ -106,7 +106,11 @@ enum
FR_ID_PEERS = 11,
/* destination of the torrent: zero-terminated string */
FR_ID_DESTINATION = 12
FR_ID_DESTINATION = 12,
/* pex flag
* 't' if pex is enabled, 'f' if disabled */
FR_ID_PEX = 13
};
@ -286,6 +290,12 @@ tr_fastResumeSave( const tr_torrent * tor )
tr_free( buf );
}
if( TRUE ) /* FR_ID_PEX */
{
const char flag = tor->pexDisabled ? 'f' : 't';
fastResumeWriteData( FR_ID_PEX, &flag, 1, 1, file );
}
if( TRUE ) /* FR_ID_RUN */
{
const char is_running = tor->isRunning ? 't' : 'f';
@ -643,6 +653,19 @@ fastResumeLoadImpl ( tr_torrent * tor,
ret |= TR_FR_RUN;
continue;
}
case FR_ID_PEX:
{
char ch;
if( fread( &ch, 1, 1, file ) != 1 )
{
fclose( file );
return ret;
}
tor->pexDisabled = ch!='t';
ret |= TR_FR_PEX;
continue;
}
case FR_ID_DOWNLOADED:
/* read download total */

View file

@ -38,6 +38,7 @@ enum
TR_FR_SPEEDLIMIT = (1<<6),
TR_FR_RUN = (1<<7),
TR_FR_DESTINATION = (1<<8),
TR_FR_PEX = (1<<9)
};
/**