diff options
author | Artur Dryomov <artur.dryomov@gmail.com> | 2013-09-03 15:53:03 +0300 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2013-09-05 09:48:03 +0000 |
commit | 4c30c48684cd09a057906f30d7a3f8927ecabb52 (patch) | |
tree | dc8b716a914fdc60dc9d0dc8c3fc68cb82655441 /android | |
parent | 379a53017447fbf2a459f82ae8905b6683e80e8d (diff) |
Move building server via TCP servers finder to a separate method.
Change-Id: I8def7a5f7ecf924f6cc61f3a037defa9e8116089
Reviewed-on: https://gerrit.libreoffice.org/5815
Reviewed-by: Michael Meeks <michael.meeks@suse.com>
Tested-by: Michael Meeks <michael.meeks@suse.com>
Diffstat (limited to 'android')
-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); |