More toying with network stuff. Hopefully fixed more problems without making even...
[MenuTunes.git] / NetworkController.m
index 6c9631c..f2989e3 100755 (executable)
@@ -111,6 +111,7 @@ static NetworkController *sharedController;
     } else if (serverOn && !status && [serverConnection isValid]) {
         //Turn off
         [service stop];
+        [service release];
         [rootObject invalidate];
         [serverConnection registerName:nil];
         [serverConnection invalidate];
@@ -240,6 +241,18 @@ static NetworkController *sharedController;
     return valid;
 }
 
+- (void)resetServerName
+{
+    if ([self isServerOn]) {
+        [service stop];
+        [service release];
+        service = [[NSNetService alloc] initWithDomain:@""
+                                        type:@"_mttp._tcp."
+                                        name:[[NSUserDefaults standardUserDefaults] stringForKey:@"sharedPlayerName"]
+                                        port:SERVER_PORT];
+    }
+}
+
 - (BOOL)isServerOn
 {
     return serverOn;