From 5473b841a09efe46cfbaf70d3c62526e224386f8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Fri, 18 Oct 2013 07:08:35 +0200 Subject: [PATCH] Make port configurable. --- src/main/java/net/pterodactylus/xdcc/main/Main.java | 2 +- src/main/java/net/pterodactylus/xdcc/ui/stdin/NetworkAdapter.java | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) 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 { -- 2.7.4