#3686 "add rpc command to cleanly shutdown daemon" - added for Mac client

This commit is contained in:
Mitchell Livingston
2011-01-15 18:44:39 +00:00
parent a65e02257d
commit 792b5ad6f7
2 changed files with 9 additions and 5 deletions

View File

@@ -103,8 +103,7 @@ typedef enum
#warning change to QLPreviewPanel
id fPreviewPanel;
BOOL fQuitting;
BOOL fUpdateInProgress;
BOOL fQuitRequested;
BOOL fPauseOnLaunch;
Badger * fBadger;

View File

@@ -390,7 +390,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
[[UKKQueue sharedFileWatcher] setDelegate: self];
[[SUUpdater sharedUpdater] setDelegate: self];
fUpdateInProgress = NO;
fQuitRequested = NO;
fPauseOnLaunch = (GetCurrentKeyModifiers() & (optionKey | rightOptionKey)) != 0;
}
@@ -677,7 +677,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
- (NSApplicationTerminateReply) applicationShouldTerminate: (NSApplication *) sender
{
if (!fUpdateInProgress && [fDefaults boolForKey: @"CheckQuit"])
if (!fQuitRequested && [fDefaults boolForKey: @"CheckQuit"])
{
NSInteger active = 0, downloading = 0;
for (Torrent * torrent in fTorrents)
@@ -4358,7 +4358,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
- (void) updaterWillRelaunchApplication: (SUUpdater *) updater
{
fUpdateInProgress = YES;
fQuitRequested = YES;
}
- (NSDictionary *) registrationDictionaryForGrowl
@@ -4440,6 +4440,11 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
[fPrefsController performSelectorOnMainThread: @selector(rpcUpdatePrefs) withObject: nil waitUntilDone: NO];
break;
case TR_RPC_SESSION_CLOSE:
fQuitRequested = YES;
[NSApp performSelectorOnMainThread: @selector(terminate:) withObject: self waitUntilDone: NO];
break;
default:
NSAssert1(NO, @"Unknown RPC command received: %d", type);
[torrent release];