fix: 修复tracker_server配置为域名时,打印信息有误的问题

dev
niloay6 2021-07-27 10:50:18 +08:00
parent 4987967e0b
commit 8db4ff7dd0
2 changed files with 5 additions and 1 deletions

View File

@ -337,7 +337,8 @@ public class ClientGlobal {
InetSocketAddress[] trackerAddresses = g_tracker_group.tracker_servers;
for (InetSocketAddress inetSocketAddress : trackerAddresses) {
if(trackerServers.length() > 0) trackerServers += ",";
trackerServers += inetSocketAddress.toString().substring(1);
String address = inetSocketAddress.toString();
trackerServers += address.startsWith("/") ? address.substring(1) : address;
}
}
return "{"

View File

@ -21,6 +21,9 @@ public class ClientGlobalTests {
ClientGlobal.initByProperties(props);
System.out.println("ClientGlobal.configInfo(): " + ClientGlobal.configInfo());
String trackerServer = "www.baidu.com:22122";
ClientGlobal.initByTrackers(trackerServer);
System.out.println("Host >>> ClientGlobal.configInfo() : " + ClientGlobal.configInfo());
}
}