Mercurial > hg > Applications > TreeVNC
changeset 195:a204b53a30c7
set connectTo localhostname.
author | oc |
---|---|
date | Thu, 26 Jun 2014 19:20:23 +0900 |
parents | b038aafeb2b0 |
children | 012941447841 |
files | .project src/main/java/com/glavsoft/rfb/protocol/Protocol.java src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java src/main/java/jp/ac/u_ryukyu/treevnc/TreeVncCommand.java src/main/java/jp/ac/u_ryukyu/treevnc/server/TreeManagement.java src/main/java/jp/ac/u_ryukyu/treevnc/server/TreeVNCNode.java |
diffstat | 6 files changed, 34 insertions(+), 35 deletions(-) [+] |
line wrap: on
line diff
--- a/.project Thu Jun 26 15:20:11 2014 +0900 +++ b/.project Thu Jun 26 19:20:23 2014 +0900 @@ -15,4 +15,15 @@ <nature>org.springsource.ide.eclipse.gradle.core.nature</nature> <nature>org.eclipse.jdt.core.javanature</nature> </natures> + <filteredResources> + <filter> + <id>1403763736200</id> + <name></name> + <type>30</type> + <matcher> + <id>org.eclipse.ui.ide.multiFilter</id> + <arguments>1.0-projectRelativePath-matches-false-false-build</arguments> + </matcher> + </filter> + </filteredResources> </projectDescription>
--- a/src/main/java/com/glavsoft/rfb/protocol/Protocol.java Thu Jun 26 15:20:11 2014 +0900 +++ b/src/main/java/com/glavsoft/rfb/protocol/Protocol.java Thu Jun 26 19:20:23 2014 +0900 @@ -181,12 +181,14 @@ * should be regulated to avoid hogging the network. */ public void startNormalHandling(IRfbSessionListener rfbSessionListener, - IRepaintController repaintController, ClipboardController clipboardController) { - receiverTask = new ReceiverTask( + IRepaintController repaintController, ClipboardController clipboardController, + MyRfbProto rfb) + { + receiverTask = new ReceiverTask( reader, repaintController, clipboardController, - decoders, this); - startNormalHandling1(rfbSessionListener, repaintController, clipboardController); + decoders, this, rfb); + startNormalHandling1(rfbSessionListener, repaintController, clipboardController); } public void startNormalHandling1(IRfbSessionListener rfbSessionListener, @@ -336,16 +338,7 @@ return protocolVersion; } - public void startNormalHandling(IRfbSessionListener rfbSessionListener, - IRepaintController repaintController, ClipboardController clipboardController, - MyRfbProto rfb) - { - receiverTask = new ReceiverTask( - reader, repaintController, - clipboardController, - decoders, this, rfb); - startNormalHandling1(rfbSessionListener, repaintController, clipboardController); - } + @Override
--- a/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Thu Jun 26 15:20:11 2014 +0900 +++ b/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Thu Jun 26 19:20:23 2014 +0900 @@ -96,21 +96,6 @@ } } - - public ReceiverTask(Reader reader, - IRepaintController repaintController, ClipboardController clipboardController, - DecodersContainer decoders, ProtocolContext context) { - this.reader = reader; - this.repaintController = repaintController; - this.clipboardController = clipboardController; - this.context = context; - this.decoders = decoders; - renderer = repaintController.createRenderer(reader, context.getFbWidth(), context.getFbHeight(), - context.getPixelFormat()); - fullscreenFbUpdateIncrementalRequest = - new FramebufferUpdateRequestMessage(0, 0, context.getFbWidth(), context.getFbHeight(), true); - } - @Override public void run() { isRunning = true;
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/TreeVncCommand.java Thu Jun 26 15:20:11 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/TreeVncCommand.java Thu Jun 26 19:20:23 2014 +0900 @@ -57,7 +57,7 @@ handleWhereToConnect(port,hostname, myHostName); break; case LOST_PARENT : - handleLostParent(port,hostname); + handleLostParent(port,hostname, myHostName); break; case NEW_NODE : rfb.newClient(connection, os, is); @@ -119,9 +119,10 @@ * if root is not here, clients die themselves. * @param port * @param hostname + * @param myHostName */ - private void handleLostParent(int port, String hostname) { - rfb.getTreeManager().fixLostParent(hostname,port); + private void handleLostParent(int port, String hostname, String myHostName) { + rfb.getTreeManager().fixLostParent(hostname,port,myHostName); } public TreeCommand getCommand () {
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/server/TreeManagement.java Thu Jun 26 15:20:11 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/server/TreeManagement.java Thu Jun 26 19:20:23 2014 +0900 @@ -72,15 +72,18 @@ * A parent is lost, move last node which has no child to the position * @param hostname * @param port + * @param myHostName */ - public void fixLostParent(String hostname, int port) { + public void fixLostParent(String hostname, int port, String myHostName) { TreeVNCNode lostParentNode = lookup(nodeList,hostname,port); if (lostParentNode == null ) return; // some thing wrong int treeNumber = lostParentNode.getTreeNum(); TreeVNCNode deadParent = getParentNode(treeNumber); + TreeVNCNode me = nodeList.getFirst(); + me.setHostName(myHostName); if (deadParent.getTreeNum() == 0) { // if dead root, connect me. - connectTo(nodeList.getFirst(), lostParentNode); + connectTo(me, lostParentNode); return; } if (getChildNode(deadParent, 0) == null) return; @@ -151,7 +154,9 @@ connectTo(parent, node); } else { // connect to me - connectTo(nodeList.getFirst(), node); + TreeVNCNode me = nodeList.getFirst(); + me.setHostName(localhostname); + connectTo(me, node); } if (showTreeNode) { showTreeNode();
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/server/TreeVNCNode.java Thu Jun 26 15:20:11 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/server/TreeVNCNode.java Thu Jun 26 19:20:23 2014 +0900 @@ -32,5 +32,9 @@ port = acceptPort; } + public void setHostName(String localhostname) { + hostname = localhostname; + } + }