Mercurial > hg > Applications > TreeVNC
changeset 152:4096a8408fdb
set myaddress to treeVNC protocol in connect_to.
author | oc |
---|---|
date | Fri, 13 Jun 2014 17:27:41 +0900 |
parents | 43b4281cf27d |
children | e68dfd1972ac |
files | src/main/java/jp/ac/u_ryukyu/treevnc/TreeVncCommand.java src/main/java/jp/ac/u_ryukyu/treevnc/client/TreeVncProtocol.java |
diffstat | 2 files changed, 12 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/TreeVncCommand.java Fri Jun 13 17:00:04 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/TreeVncCommand.java Fri Jun 13 17:27:41 2014 +0900 @@ -64,10 +64,10 @@ handleFindRootReply(port,hostname,myHostName); break; case ProtocolContext.CONNECT_TO_AS_LEADER : - handleConnectTo( port,hostname,true); + handleConnectTo( port,hostname,myHostName,true); break; case ProtocolContext.CONNECT_TO : - handleConnectTo( port,hostname,false); + handleConnectTo( port,hostname,myHostName,false); break; case ProtocolContext.FIND_ROOT : // this is a multicast message, it is handled in FindRootListener @@ -84,7 +84,9 @@ } - /** + + + /** * new clients ask root to where to connect * tell him his parent * @param port @@ -104,11 +106,12 @@ * @throws SocketException * @throws UnknownHostException */ - void handleConnectTo(int port, String hostname, boolean leader) throws UnknownHostException, SocketException, IOException { + void handleConnectTo(int port, String hostname, String myHostName, boolean leader) + throws UnknownHostException, SocketException, IOException { if (rfb.isRoot()) { return; // we don't have parent } - treeProtocol.connectToParenet(port, hostname,leader); + treeProtocol.connectToParenet(port, hostname, myHostName, leader); } /**
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/client/TreeVncProtocol.java Fri Jun 13 17:00:04 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/client/TreeVncProtocol.java Fri Jun 13 17:27:41 2014 +0900 @@ -119,17 +119,18 @@ * Start client with new parent (including reconnection) * @param port * @param hostname + * @param myHostName * @param leader * @throws IOException */ - public void connectToParenet(int port, String hostname, boolean leader) + public void connectToParenet(int port, String hostname, String myHostName, boolean leader) throws IOException { this.leaderFlag = leader; + this.myAddress = myHostName; client.setTeminationType(true); client.closeApp(); client.setConnectionParam(hostname, port); - SwingUtilities.invokeLater(client); - // client.run(); + client.run(); }