Changeset 10878
- Timestamp:
- Jun 26, 2010, 6:52:05 PM (13 years ago)
- Location:
- branches/2.0x
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.0x/libtransmission/peer-mgr.c
r10876 r10878 3132 3132 } 3133 3133 3134 /* possibly stop torrents that have an error */ 3134 /* stop torrents that are ready to stop, but couldn't be stopped earlier 3135 * during the peer-io callback call chain */ 3135 3136 tor = NULL; 3136 3137 while(( tor = tr_torrentNext( mgr->session, tor ))) 3137 if( tor->is Running && ( tor->error == TR_STAT_LOCAL_ERROR ))3138 if( tor->isStopping ) 3138 3139 tr_torrentStop( tor ); 3139 3140 -
branches/2.0x/libtransmission/rpcimpl.c
r10638 r10878 222 222 { 223 223 tr_torrent * tor = torrents[i]; 224 224 225 if( tor->isRunning ) 225 226 { 226 t r_torrentStop( tor );227 tor->isStopping = TRUE; 227 228 notify( session, TR_RPC_TORRENT_STOPPED, tor ); 228 229 } -
branches/2.0x/libtransmission/torrent.c
r10862 r10878 322 322 tr_torinf( tor, "Seed ratio reached; pausing torrent" ); 323 323 324 t r_torrentStop( tor );324 tor->isStopping = TRUE; 325 325 326 326 /* maybe notify the client */ … … 347 347 evutil_vsnprintf( tor->errorString, sizeof( tor->errorString ), fmt, ap ); 348 348 va_end( ap ); 349 350 if( tor->isRunning ) 351 tor->isStopping = TRUE; 349 352 } 350 353 … … 1361 1364 { 1362 1365 tr_torrentSetLocalError( tor, _( "No data found! Reconnect any disconnected drives, use \"Set Location\", or restart the torrent to re-download." ) ); 1363 tr_torrentStop( tor );1364 1366 } 1365 1367 else … … 1444 1446 { 1445 1447 tr_torrentSetLocalError( tor, _( "Can't find local data. Try \"Set Location\" to find it, or restart the torrent to re-download." ) ); 1446 tr_torrentStop( tor );1447 1448 } 1448 1449 else if( tor->startAfterVerify ) … … 1534 1535 1535 1536 tor->isRunning = 0; 1537 tor->isStopping = 0; 1536 1538 tr_torrentSetDirty( tor ); 1537 1539 tr_runInEventThread( tor->session, stopTorrent, tor ); … … 1619 1621 static void 1620 1622 fireCompletenessChange( tr_torrent * tor, 1621 tr_completeness status ) 1623 tr_completeness status, 1624 tr_bool wasRunning ) 1622 1625 { 1623 1626 assert( tr_isTorrent( tor ) ); … … 1627 1630 1628 1631 if( tor->completeness_func ) 1629 tor->completeness_func( tor, status, tor->completeness_func_user_data ); 1632 tor->completeness_func( tor, status, wasRunning, 1633 tor->completeness_func_user_data ); 1630 1634 } 1631 1635 … … 1697 1701 tr_torrentRecheckCompleteness( tr_torrent * tor ) 1698 1702 { 1703 tr_bool wasRunning; 1699 1704 tr_completeness completeness; 1700 1705 … … 1704 1709 1705 1710 completeness = tr_cpGetStatus( &tor->completion ); 1711 wasRunning = tor->isRunning; 1706 1712 1707 1713 if( completeness != tor->completeness ) … … 1736 1742 } 1737 1743 1738 fireCompletenessChange( tor, completeness );1744 fireCompletenessChange( tor, wasRunning, completeness ); 1739 1745 1740 1746 tr_torrentSetDirty( tor ); -
branches/2.0x/libtransmission/torrent.h
r10843 r10878 232 232 233 233 tr_bool isRunning; 234 tr_bool isStopping; 234 235 tr_bool isDeleting; 235 236 tr_bool startAfterVerify; -
branches/2.0x/libtransmission/transmission.h
r10697 r10878 1277 1277 tr_completeness; 1278 1278 1279 /** 1280 * @param wasRunning whether or not the torrent was running when 1281 * it changed its completeness state 1282 */ 1279 1283 typedef void ( tr_torrent_completeness_func )( tr_torrent * torrent, 1280 1284 tr_completeness completeness, 1285 tr_bool wasRunning, 1281 1286 void * user_data ); 1282 1287 -
branches/2.0x/macosx/Controller.m
r10559 r10878 1889 1889 Torrent * torrent = [notification object]; 1890 1890 1891 if ([ torrent isActive])1891 if ([[[notification userInfo] objectForKey: @"WasRunning"] boolValue]) 1892 1892 { 1893 1893 if (!fSoundPlaying && [fDefaults boolForKey: @"PlayDownloadSound"]) … … 1919 1919 object: [torrent dataLocation]]; 1920 1920 1921 if ([ fDefaults boolForKey: @"QueueSeed"] && [self numToStartFromQueue: NO] == 0)1921 if ([torrent isActive] && [fDefaults boolForKey: @"QueueSeed"] && [self numToStartFromQueue: NO] == 0) 1922 1922 { 1923 1923 [torrent stopTransfer]; … … 1932 1932 { 1933 1933 Torrent * torrent = [notification object]; 1934 if ([torrent isActive]) 1935 { 1936 if ([fDefaults boolForKey: @"Queue"] && [self numToStartFromQueue: YES] == 0) 1937 { 1938 [torrent stopTransfer]; 1939 [torrent setWaitToStart: YES]; 1940 } 1934 if ([torrent isActive] && [fDefaults boolForKey: @"Queue"] && [self numToStartFromQueue: YES] == 0) 1935 { 1936 [torrent stopTransfer]; 1937 [torrent setWaitToStart: YES]; 1941 1938 } 1942 1939 -
branches/2.0x/macosx/Torrent.m
r10712 r10878 44 44 index: (NSInteger) index flatList: (NSMutableArray *) flatFileList; 45 45 46 - (void) completenessChange: (NS Number *) status;46 - (void) completenessChange: (NSDictionary *) statusInfo; 47 47 - (void) ratioLimitHit; 48 48 - (void) metadataRetrieved; … … 54 54 @end 55 55 56 void completenessChangeCallback(tr_torrent * torrent, tr_completeness status, void * torrentData) 57 { 58 [(Torrent *)torrentData performSelectorOnMainThread: @selector(completenessChange:) 59 withObject: [[NSNumber alloc] initWithInt: status] waitUntilDone: NO]; 56 void completenessChangeCallback(tr_torrent * torrent, tr_completeness status, tr_bool wasRunning, void * torrentData) 57 { 58 NSDictionary * dict = [[NSDictionary alloc] initWithObjectsAndKeys: [NSNumber numberWithInt: status], @"Status", 59 [NSNumber numberWithBool: wasRunning], @"WasRunning", nil]; 60 [(Torrent *)torrentData performSelectorOnMainThread: @selector(completenessChange:) withObject: dict waitUntilDone: NO]; 60 61 } 61 62 … … 1748 1749 1749 1750 //status has been retained 1750 - (void) completenessChange: (NS Number *) status1751 - (void) completenessChange: (NSDictionary *) statusInfo 1751 1752 { 1752 1753 fStat = tr_torrentStat(fHandle); //don't call update yet to avoid auto-stop 1753 1754 1754 switch ([ statusintValue])1755 switch ([[statusInfo objectForKey: @"Status"] intValue]) 1755 1756 { 1756 1757 case TR_SEED: 1757 1758 case TR_PARTIAL_SEED: 1758 [[NSNotificationCenter defaultCenter] postNotificationName: @"TorrentFinishedDownloading" object: self]; 1759 //simpler to create a new dictionary than to use statusInfo - avoids retention chicanery 1760 [[NSNotificationCenter defaultCenter] postNotificationName: @"TorrentFinishedDownloading" object: self 1761 userInfo: [NSDictionary dictionaryWithObject: [statusInfo objectForKey: @"WasRunning"] forKey: @"WasRunning"]]; 1759 1762 break; 1760 1763 … … 1763 1766 break; 1764 1767 } 1765 [status release];1768 [statusInfo release]; 1766 1769 1767 1770 [self update];
Note: See TracChangeset
for help on using the changeset viewer.