diff options
-rw-r--r-- | android/sdremote/src/org/libreoffice/impressremote/communication/TcpServersFinder.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/TcpServersFinder.java b/android/sdremote/src/org/libreoffice/impressremote/communication/TcpServersFinder.java index b31e4f66edc3..84f305be9809 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/communication/TcpServersFinder.java +++ b/android/sdremote/src/org/libreoffice/impressremote/communication/TcpServersFinder.java @@ -124,11 +124,7 @@ class TcpServersFinder implements ServersFinder, Runnable { String aFoundServerHostname = aSearchResultScanner.nextLine(); - Server aFoundServer = new Server(Server.Protocol.TCP, - aSearchResultPacket.getAddress().getHostAddress(), - aFoundServerHostname); - - addServer(aFoundServer); + addServer(buildServer(aSearchResultPacket, aFoundServerHostname)); callUpdatingServersList(); } @@ -156,6 +152,12 @@ class TcpServersFinder implements ServersFinder, Runnable { mServers.put(aServer.getAddress(), aServer); } + private Server buildServer(DatagramPacket aSearchResultPacket, String aServerHostname) { + String aServerAddress = aSearchResultPacket.getAddress().getHostAddress(); + + return Server.newTcpInstance(aServerAddress, aServerHostname); + } + private void callUpdatingServersList() { Intent aIntent = Intents.buildServersListChangedIntent(); LocalBroadcastManager.getInstance(mContext).sendBroadcast(aIntent); |