Make port configurable.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 18 Oct 2013 05:08:35 +0000 (07:08 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 18 Oct 2013 05:08:35 +0000 (07:08 +0200)
src/main/java/net/pterodactylus/xdcc/main/Main.java
src/main/java/net/pterodactylus/xdcc/ui/stdin/NetworkAdapter.java

index 14e3bda..d56ccb1 100644 (file)
@@ -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();
index cff376a..a45a341 100644 (file)
@@ -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 {