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 authored and Sheikah45 committed Apr 21, 2024
1 parent 60c84a7 commit e4ff009
Showing 1 changed file with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,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 @@ -131,15 +130,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 @@ -227,7 +219,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 e4ff009

Please sign in to comment.