mirror of
https://gitee.com/BDWare/cp.git
synced 2025-12-27 17:46:45 +00:00
update for async get endpoint info
This commit is contained in:
@@ -8,7 +8,7 @@ plugins {
|
|||||||
apply from: '../spotless.gradle'
|
apply from: '../spotless.gradle'
|
||||||
|
|
||||||
group = "org.bdware.sc"
|
group = "org.bdware.sc"
|
||||||
version = "1.10.5"
|
version = "1.10.6"
|
||||||
tasks.withType(JavaCompile) {
|
tasks.withType(JavaCompile) {
|
||||||
// options.compilerArgs << '-Xlint:none'
|
// options.compilerArgs << '-Xlint:none'
|
||||||
// options.compilerArgs << '-Xlint:deprecation' << "-Werror"
|
// options.compilerArgs << '-Xlint:deprecation' << "-Werror"
|
||||||
|
|||||||
@@ -82,22 +82,30 @@ public class DoipLocalSingleton {
|
|||||||
}
|
}
|
||||||
if (config.routerURI != null && config.repoName != null) {
|
if (config.routerURI != null && config.repoName != null) {
|
||||||
AuditIrpClient irpClient = new AuditIrpClient(config);
|
AuditIrpClient irpClient = new AuditIrpClient(config);
|
||||||
EndpointInfo endpointInfo = irpClient.getEndpointInfo();
|
EndpointInfo endpointInfo = null;
|
||||||
repoID = endpointInfo.getDoId();
|
for (int i = 0; i < 10; i++) {
|
||||||
owner = endpointInfo.getPubKey();
|
endpointInfo = irpClient.getEndpointInfo();
|
||||||
infos.clear();
|
if (endpointInfo == null) Thread.sleep(200);
|
||||||
|
}
|
||||||
|
if (endpointInfo != null) {
|
||||||
|
repoID = endpointInfo.getDoId();
|
||||||
|
owner = endpointInfo.getPubKey();
|
||||||
|
infos.clear();
|
||||||
|
}
|
||||||
infos.add(new DoipListenerConfig(endpointInfo.getURI(), "2.1"));
|
infos.add(new DoipListenerConfig(endpointInfo.getURI(), "2.1"));
|
||||||
port = new URI(endpointInfo.getURI()).getPort();
|
port = new URI(endpointInfo.getURI()).getPort();
|
||||||
SharableVarManager.initSharableVarManager(repoID, config);
|
SharableVarManager.initSharableVarManager(repoID, config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 如果启动参数中添加了 doipStartPort 参数,使用该参数作为启动端口
|
// 如果启动参数中添加了 doipStartPort 参数,使用该参数作为启动端口
|
||||||
if (otherConfigs != null && otherConfigs.isJsonObject() && otherConfigs.getAsJsonObject().has("doipStartPort") && infos.size() == 1) {
|
if (otherConfigs != null && otherConfigs.isJsonObject()
|
||||||
|
&& otherConfigs.getAsJsonObject().has("doipStartPort") && infos.size() == 1) {
|
||||||
int doipStartPort = otherConfigs.getAsJsonObject().get("doipStartPort").getAsInt();
|
int doipStartPort = otherConfigs.getAsJsonObject().get("doipStartPort").getAsInt();
|
||||||
// 如果当前启动的端口和指定的端口不一致,修改启动端口
|
// 如果当前启动的端口和指定的端口不一致,修改启动端口
|
||||||
if (doipStartPort != port) {
|
if (doipStartPort != port) {
|
||||||
infos.get(0).url = infos.get(0).url.replace(String.valueOf(port), String.valueOf(doipStartPort));
|
infos.get(0).url = infos.get(0).url.replace(String.valueOf(port),
|
||||||
port = doipStartPort;
|
String.valueOf(doipStartPort));
|
||||||
|
port = doipStartPort;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user