1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-24 08:43:27 +00:00

reflect some of the changes in libT (some, which means it still doesn't compile ;))

This commit is contained in:
Mitchell Livingston 2007-06-27 00:42:06 +00:00
parent af92ca6211
commit f39eb233f8
2 changed files with 9 additions and 26 deletions

View file

@ -544,7 +544,9 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
//save history and stop running torrents
[self updateTorrentHistory];
[fTorrents makeObjectsPerformSelector: @selector(stopTransferForQuit)];
#warning check if all torrents are fully released
[fDisplayedTorrents removeAllObjects];
[fTorrents removeAllObjects];
//disable NAT traversal
tr_natTraversalEnable(fLib, 0);
@ -558,22 +560,10 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
//clear badge
[fBadger clearBadge];
//wait for running transfers to stop (5 second timeout)
//wait for running transfers to stop and for NAT to be disabled (5 second timeout)
NSDate * start = [NSDate date];
BOOL timeUp = NO;
enumerator = [fTorrents objectEnumerator];
Torrent * torrent;
while (!timeUp && (torrent = [enumerator nextObject]))
while (![torrent isPaused] && !(timeUp = [start timeIntervalSinceNow] < -5.0))
{
usleep(100000);
[torrent update];
}
//wait for NAT to be disabled (same 5 second timeout)
while (!([start timeIntervalSinceNow] < -5.0)
&& tr_handleStatus(fLib)->natTraversalStatus != TR_NAT_TRAVERSAL_DISABLED)
while ([start timeIntervalSinceNow] >= -5.0
&& (tr_torrentCount(fLib) > 0 || tr_handleStatus(fLib)->natTraversalStatus != TR_NAT_TRAVERSAL_DISABLED))
usleep(100000);
}
@ -1207,7 +1197,6 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
{
if (code == NSOKButton)
{
//move torrent data file to new location
NSEnumerator * enumerator = [torrents objectEnumerator];
Torrent * torrent;
while ((torrent = [enumerator nextObject]))

View file

@ -387,7 +387,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
{
NSString * tempString;
case TR_STATUS_PAUSE:
case TR_STATUS_STOPPED:
if (fWaitToStart)
{
tempString = ![self allDownloaded]
@ -602,12 +602,6 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
}
}
- (void) stopTransferForQuit
{
if ([self isActive])
tr_torrentStop(fHandle);
}
- (void) sleep
{
if ((fResumeOnWake = [self isActive]))
@ -1061,7 +1055,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
{
switch( fStat->status )
{
case TR_STATUS_PAUSE:
case TR_STATUS_STOPPED:
return NSLocalizedString(@"Paused", "Torrent -> status string");
break;
@ -1114,7 +1108,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
- (BOOL) isPaused
{
return fStat->status == TR_STATUS_PAUSE;
return fStat->status == TR_STATUS_STOPPED;
}
- (BOOL) isWaitingToChecking