From: David ‘Bombe’ Roden Date: Fri, 18 Oct 2013 05:08:35 +0000 (+0200) Subject: Make port configurable. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=5473b841a09efe46cfbaf70d3c62526e224386f8;p=xudocci.git Make port configurable. --- diff --git a/src/main/java/net/pterodactylus/xdcc/main/Main.java b/src/main/java/net/pterodactylus/xdcc/main/Main.java index 14e3bda..d56ccb1 100644 --- a/src/main/java/net/pterodactylus/xdcc/main/Main.java +++ b/src/main/java/net/pterodactylus/xdcc/main/Main.java @@ -104,7 +104,7 @@ public class Main { telnetInterface.start(); eventBus.register(telnetInterface); - NetworkAdapter networkAcceptor = new NetworkAdapter(eventBus, core); + NetworkAdapter networkAcceptor = new NetworkAdapter(eventBus, core, configuration.getTelnetPort()); networkAcceptor.start(); core.start(); diff --git a/src/main/java/net/pterodactylus/xdcc/ui/stdin/NetworkAdapter.java b/src/main/java/net/pterodactylus/xdcc/ui/stdin/NetworkAdapter.java index cff376a..a45a341 100644 --- a/src/main/java/net/pterodactylus/xdcc/ui/stdin/NetworkAdapter.java +++ b/src/main/java/net/pterodactylus/xdcc/ui/stdin/NetworkAdapter.java @@ -44,6 +44,7 @@ public class NetworkAdapter extends AbstractExecutionThreadService { /** The core being controlled. */ private final Core core; + private final int port; /** * Creates a new network acceptor. @@ -51,14 +52,15 @@ public class NetworkAdapter extends AbstractExecutionThreadService { * @param eventBus * @param core */ - public NetworkAdapter(EventBus eventBus, Core core) { + public NetworkAdapter(EventBus eventBus, Core core, int port) { this.eventBus = eventBus; this.core = core; + this.port = port; } @Override protected void run() throws Exception { - ServerSocket serverSocket = new ServerSocket(45678); + ServerSocket serverSocket = new ServerSocket(port); serverSocket.setSoTimeout((int) TimeUnit.SECONDS.toMillis(1)); while (isRunning()) { try {