Made it so that the stupid client DISCONNECTS, with the side effect of
[MenuTunes.git] / NetworkController.m
index 49b8321..d5c8465 100755 (executable)
@@ -110,9 +110,9 @@ static NetworkController *sharedController;
     } else if (serverOn && !status && [serverConnection isValid]) {
         //Turn off
         [service stop];
+        [clientProxy invalidate];
         [serverConnection registerName:nil];
         [serverConnection release];
-        [clientProxy release];
         ITDebugLog(@"Stopped server.");
         serverOn = NO;
     }
@@ -200,6 +200,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 +217,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 +233,7 @@ static NetworkController *sharedController;
     }
     [testConnection release];
     [testPort release];
-    return YES;
+    return valid;
 }
 
 - (BOOL)isServerOn