Merge pull request #94 from niloay6/fix_configInfo_print

fix: 修复tracker_server配置为域名时,打印信息有误的问题
dev
YuQing 2021-12-10 15:52:15 +08:00 committed by GitHub
commit 9cc79ed75d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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());
}
}