static void
tr_torrentClearError( tr_torrent * tor )
{
- assert( tr_isTorrent( tor ) );
-
tor->error = TR_STAT_OK;
tor->errorString[0] = '\0';
tor->errorTracker[0] = '\0';
static void
tr_torrentResetTransferStats( tr_torrent * tor )
{
- assert( tr_isTorrent( tor ) );
-
tr_torrentLock( tor );
tor->downloadedPrev += tor->downloadedCur;
tr_session * session = tor->session;
tr_info * inf = &tor->info;
- assert( tr_isTorrent( tor ) );
assert( !tor->isRunning );
tr_sessionLock( session );
static void
torrentStart( tr_torrent * tor )
{
- assert( tr_isTorrent( tor ) );
-
/* already running... */
if( tor->isRunning )
return;
{
tr_torrent * tor = vtor;
- assert( tr_isTorrent( tor ) );
tr_sessionLock( tor->session );
/* if the torrent's already being verified, stop it */
tr_completeness status,
tr_bool wasRunning )
{
- assert( tr_isTorrent( tor ) );
assert( ( status == TR_LEECH )
|| ( status == TR_SEED )
|| ( status == TR_PARTIAL_SEED ) );
char timeStr[128];
const time_t now = tr_time( );
- assert( tr_isTorrent( tor ) );
-
tr_strlcpy( timeStr, ctime( &now ), sizeof( timeStr ) );
*strchr( timeStr,'\n' ) = '\0';
static void
setFileDND( tr_torrent * tor, tr_file_index_t fileIndex, int doDownload )
{
- tr_file * file;
const int8_t dnd = !doDownload;
tr_piece_index_t firstPiece;
int8_t firstPieceDND;
tr_piece_index_t lastPiece;
int8_t lastPieceDND;
tr_file_index_t i;
+ tr_file * file = &tor->info.files[fileIndex];
- assert( tr_isTorrent( tor ) );
-
- file = &tor->info.files[fileIndex];
file->dnd = dnd;
firstPiece = file->firstPiece;
lastPiece = file->lastPiece;
tr_ptrArray * folders,
tr_ptrArray * dirtyFolders )
{
- int i;
struct stat sb;
- char * buf;
-
- assert( tr_isTorrent( tor ) );
+ char * buf = tr_buildPath( dir, base, NULL );
+ int i = stat( buf, &sb );
- buf = tr_buildPath( dir, base, NULL );
- i = stat( buf, &sb );
if( !i )
{
DIR * odir = NULL;
char * tmp = cpch ? tr_strndup( firstFile, cpch - firstFile ) : NULL;
char * root = tr_buildPath( tor->currentDir, tmp, NULL );
- assert( tr_isTorrent( tor ) );
-
for( f=0; f<tor->info.fileCount; ++f ) {
tr_ptrArrayInsertSorted( &torrentFiles, tr_strdup( tor->info.files[f].name ), vstrcmp );
tr_ptrArrayInsertSorted( &torrentFiles, tr_torrentBuildPartial( tor, f ), vstrcmp );