X-Git-Url: http://git.ithinksw.org/MenuTunes.git/blobdiff_plain/2404965b693451fd71dcffd06eb82695e9085389..d5201ad763c5a486832854443d946ff140902626:/NetworkController.m?ds=sidebyside diff --git a/NetworkController.m b/NetworkController.m index 49b8321..70994df 100755 --- a/NetworkController.m +++ b/NetworkController.m @@ -78,10 +78,10 @@ static NetworkController *sharedController; serverConnection = [[NSConnection alloc] initWithReceivePort:serverPort sendPort:serverPort]; clientProxy = [[NetworkObject alloc] init]; - [serverConnection setRootObject:[clientProxy autorelease]]; + [serverConnection setRootObject:clientProxy]; [serverConnection registerName:@"ITMTPlayerHost"]; NS_HANDLER - [[serverConnection rootObject] release]; + [clientProxy release]; [serverConnection setRootObject:nil]; [serverConnection release]; [serverPort release]; @@ -110,9 +110,10 @@ static NetworkController *sharedController; } else if (serverOn && !status && [serverConnection isValid]) { //Turn off [service stop]; + [clientProxy invalidate]; [serverConnection registerName:nil]; + [serverConnection setRootObject:nil]; [serverConnection release]; - [clientProxy release]; ITDebugLog(@"Stopped server."); serverOn = NO; } @@ -200,6 +201,7 @@ static NetworkController *sharedController; NSConnection *testConnection; NSSocketPort *testPort; NetworkObject *tempProxy; + BOOL valid; ITDebugLog(@"Checking for shared remote at %@.", host); if (fullPass) { [fullPass getBytes:&buffer range:NSMakeRange(6, 4)]; @@ -216,6 +218,7 @@ static NetworkController *sharedController; [testConnection setReplyTimeout:2]; tempProxy = (NetworkObject *)[testConnection rootProxy]; [tempProxy serverName]; + valid = [tempProxy isValid]; NS_HANDLER ITDebugLog(@"Connection to host failed: %@", host); [testConnection release]; @@ -231,7 +234,7 @@ static NetworkController *sharedController; } [testConnection release]; [testPort release]; - return YES; + return valid; } - (BOOL)isServerOn