- NSRunAlertPanel(@"Remote MenuTunes Disconnected", @"The MenuTunes server you were connected to stopped responding or quit. MenuTunes will revert back to the local player.", @"OK", nil, nil);
- if ([networkController isConnectedToServer] && [self disconnectFromServer]) {
- } else {
- ITDebugLog(@"CRITICAL ERROR DISCONNECTING!");
+ NSLog(@"%@", [exception reason]);
+ if ([[exception name] isEqualToString:NSPortTimeoutException] && [networkController isConnectedToServer]) {
+ NSRunCriticalAlertPanel(@"Remote MenuTunes Disconnected", @"The MenuTunes server you were connected to stopped responding or quit. MenuTunes will revert back to the local player.", @"OK", nil, nil);
+ if ([self disconnectFromServer]) {
+ [[PreferencesController sharedPrefs] resetRemotePlayerTextFields];
+ [NSTimer scheduledTimerWithTimeInterval:45 target:self selector:@selector(checkForRemoteServer:) userInfo:nil repeats:YES];
+ } else {
+ ITDebugLog(@"CRITICAL ERROR, DISCONNECTING!");
+ }
+ }
+}
+
+- (void)reconnect
+{
+ if ([self connectToServer] == 0) {
+ [NSTimer scheduledTimerWithTimeInterval:45 target:self selector:@selector(checkForRemoteServer:) userInfo:nil repeats:YES];