public static final String DISCONNECT_ACTION = "org.strongswan.android.CharonVpnService.DISCONNECT";
private static final String NOTIFICATION_CHANNEL = "org.strongswan.android.CharonVpnService.VPN_STATE_NOTIFICATION";
public static final String LOG_FILE = "charon.log";
+ public static final String KEY_IS_RETRY = "retry";
public static final int VPN_STATE_NOTIFICATION_ID = 1;
private String mLogFile;
if (intent != null)
{
VpnProfile profile = null;
+ boolean retry = false;
if (VPN_SERVICE_ACTION.equals(intent.getAction()))
{ /* triggered when Always-on VPN is activated */
String password = bundle.getString(VpnProfileDataSource.KEY_PASSWORD);
profile.setPassword(password);
+ retry = bundle.getBoolean(CharonVpnService.KEY_IS_RETRY, false);
+
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this);
pref.edit().putString(Constants.PREF_MRU_VPN_PROFILE, profile.getUUID().toString())
.apply();
}
}
}
+ if (profile != null && !retry)
+ { /* delete the log file if this is not an automatic retry */
+ deleteFile(LOG_FILE);
+ }
setNextProfile(profile);
}
return START_NOT_STICKY;
/* reset if this is a manual retry or a new connection */
mTimeoutProvider.reset();
}
+ else
+ { /* mark this as an automatic retry */
+ profileInfo.putBoolean(CharonVpnService.KEY_IS_RETRY, true);
+ }
intent.putExtras(profileInfo);
context.startService(intent);
}
lib->settings->set_str(lib->settings,
"charon.filelog.%s.time_format", "%b %e %T", logfile);
lib->settings->set_bool(lib->settings,
- "charon.filelog.%s.append", FALSE, logfile);
+ "charon.filelog.%s.append", TRUE, logfile);
lib->settings->set_bool(lib->settings,
"charon.filelog.%s.flush_line", TRUE, logfile);
lib->settings->set_int(lib->settings,