rework if profile is defined in params
This commit is contained in:
parent
fa64ff9192
commit
4fd6788bbb
1 changed files with 5 additions and 19 deletions
|
@ -58,7 +58,7 @@ public class BRouterService extends Service {
|
||||||
worker.baseDir = baseDir;
|
worker.baseDir = baseDir;
|
||||||
worker.segmentDir = new File(baseDir, "brouter/segments4");
|
worker.segmentDir = new File(baseDir, "brouter/segments4");
|
||||||
|
|
||||||
String remoteProfile = params.getString("remoteProfile");
|
String remoteProfile = params.getString("remoteProfile", null);
|
||||||
|
|
||||||
if (remoteProfile == null) {
|
if (remoteProfile == null) {
|
||||||
remoteProfile = checkForTestDummy(baseDir);
|
remoteProfile = checkForTestDummy(baseDir);
|
||||||
|
@ -77,7 +77,6 @@ public class BRouterService extends Service {
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
readNogos(worker, baseDir);
|
readNogos(worker, baseDir);
|
||||||
errMsg = getConfigFromModeForProfile(worker, baseDir, profile);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
errMsg = e.getLocalizedMessage();
|
errMsg = e.getLocalizedMessage();
|
||||||
}
|
}
|
||||||
|
@ -115,20 +114,9 @@ public class BRouterService extends Service {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getConfigFromModeForProfile(BRouterWorker worker, String baseDir, String profile) {
|
|
||||||
return getConfigFromMode(worker, baseDir, profile, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getConfigFromMode(BRouterWorker worker, String baseDir, String mode, String fast) {
|
private String getConfigFromMode(BRouterWorker worker, String baseDir, String mode, String fast) {
|
||||||
boolean isFast = false;
|
boolean isFast = "1".equals(fast) || "true".equals(fast) || "yes".equals(fast);
|
||||||
String profile = null;
|
String mode_key = mode + "_" + (isFast ? "fast" : "short");
|
||||||
String mode_key = null;
|
|
||||||
if (fast != null) {
|
|
||||||
isFast = "1".equals(fast) || "true".equals(fast) || "yes".equals(fast);
|
|
||||||
mode_key = mode + "_" + (isFast ? "fast" : "short");
|
|
||||||
} else {
|
|
||||||
profile = mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
BufferedReader br = null;
|
BufferedReader br = null;
|
||||||
try {
|
try {
|
||||||
|
@ -139,9 +127,7 @@ public class BRouterService extends Service {
|
||||||
if (line == null)
|
if (line == null)
|
||||||
break;
|
break;
|
||||||
ServiceModeConfig smc = new ServiceModeConfig(line);
|
ServiceModeConfig smc = new ServiceModeConfig(line);
|
||||||
if (profile!=null && !smc.profile.equals(profile))
|
if (!smc.mode.equals(mode_key))
|
||||||
continue;
|
|
||||||
else if (profile==null && !smc.mode.equals(mode_key))
|
|
||||||
continue;
|
continue;
|
||||||
worker.profileName = smc.profile;
|
worker.profileName = smc.profile;
|
||||||
worker.profilePath = baseDir + "/brouter/profiles2/" + smc.profile + ".brf";
|
worker.profilePath = baseDir + "/brouter/profiles2/" + smc.profile + ".brf";
|
||||||
|
@ -176,7 +162,7 @@ public class BRouterService extends Service {
|
||||||
} catch (Exception ee) {
|
} catch (Exception ee) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "no brouter service config found for mode " + (mode_key!=null?mode_key:profile);
|
return "no brouter service config found for mode " + mode_key;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getConfigForRemoteProfile(BRouterWorker worker, String baseDir, String remoteProfile) {
|
private String getConfigForRemoteProfile(BRouterWorker worker, String baseDir, String remoteProfile) {
|
||||||
|
|
Loading…
Reference in a new issue