Skip to content

Commit

Permalink
Hardcoded game ports for using external ice adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
Brutus5000 committed Oct 20, 2023
1 parent 3cea443 commit 6c6275f
Showing 1 changed file with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
import java.io.IOException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.net.ServerSocket;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collection;
Expand Down Expand Up @@ -117,15 +116,8 @@ public CompletableFuture<Integer> start(int gameId) {
return CompletableFuture.supplyAsync(() -> {
Path workDirectory = Path.of(System.getProperty("nativeDir", "lib")).toAbsolutePath();

int adapterPort;
int gpgPort;
try (ServerSocket adapterTestSocket = new ServerSocket(0);
ServerSocket gpgTestSocket = new ServerSocket(0)) {
adapterPort = adapterTestSocket.getLocalPort();
gpgPort = gpgTestSocket.getLocalPort();
} catch (IOException exception) {
throw new CompletionException("Unable to find open port for ICE and GPG", exception);
}
int adapterPort = 15666;
int gpgPort = 17666;

List<String> cmd = buildCommand(workDirectory, adapterPort, gpgPort, gameId);
try {
Expand Down Expand Up @@ -214,7 +206,7 @@ List<String> buildCommand(Path workDirectory, int adapterPort, int gpgPort, int

List<String> standardIceOptions = List.of(
"-cp", classpath,
"com.faforever.iceadapter.IceAdapter",
"com.faforever.ice.KiaApplication",
"--id", String.valueOf(currentPlayer.getId()),
"--game-id", String.valueOf(gameId),
"--login", currentPlayer.getUsername(),
Expand Down

0 comments on commit 6c6275f

Please sign in to comment.