Always show error when not starting/reloading

This commit is contained in:
M66B 2016-07-06 08:22:12 +02:00
parent 24a1a452b0
commit ac6fb2e51c
1 changed files with 14 additions and 12 deletions

View File

@ -346,19 +346,21 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
} catch (Throwable ex) {
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
if ((cmd == Command.start || cmd == Command.reload) &&
VpnService.prepare(ServiceSinkhole.this) == null) {
Log.w(TAG, "VPN not prepared");
showAutoStartNotification();
showErrorNotification(ex.toString());
// Retried on connectivity change
} else {
showErrorNotification(ex.toString());
if (cmd == Command.start || cmd == Command.reload) {
if (VpnService.prepare(ServiceSinkhole.this) == null) {
Log.w(TAG, "VPN not prepared");
showAutoStartNotification();
showErrorNotification(ex.toString());
// Retried on connectivity change
} else {
showErrorNotification(ex.toString());
// Disable firewall
prefs.edit().putBoolean("enabled", false).apply();
Widget.updateWidgets(ServiceSinkhole.this);
}
// Disable firewall
prefs.edit().putBoolean("enabled", false).apply();
Widget.updateWidgets(ServiceSinkhole.this);
}
} else
showErrorNotification(ex.toString());
}
}