feature: add socket connection pool

This commit is contained in:
tanyawen
2019-12-27 21:41:10 +08:00
parent 70c292f0fc
commit 3ad9f94a69
12 changed files with 517 additions and 89 deletions

View File

@@ -40,11 +40,7 @@ public class TrackerGroup {
* @return connected tracker server, null for fail
*/
public TrackerServer getConnection(int serverIndex) throws IOException {
Socket sock = new Socket();
sock.setReuseAddress(true);
sock.setSoTimeout(ClientGlobal.g_network_timeout);
sock.connect(this.tracker_servers[serverIndex], ClientGlobal.g_connect_timeout);
return new TrackerServer(sock, this.tracker_servers[serverIndex]);
return new TrackerServer(this.tracker_servers[serverIndex]);
}
/**