# HG changeset patch # User oc # Date 1403778023 -32400 # Node ID a204b53a30c712af8cc737a33cefb5bcb26d3c75 # Parent b038aafeb2b08559856f2cdfc82c330f375451cb set connectTo localhostname. diff -r b038aafeb2b0 -r a204b53a30c7 .project --- a/.project Thu Jun 26 15:20:11 2014 +0900 +++ b/.project Thu Jun 26 19:20:23 2014 +0900 @@ -15,4 +15,15 @@ org.springsource.ide.eclipse.gradle.core.nature org.eclipse.jdt.core.javanature + + + 1403763736200 + + 30 + + org.eclipse.ui.ide.multiFilter + 1.0-projectRelativePath-matches-false-false-build + + + diff -r b038aafeb2b0 -r a204b53a30c7 src/main/java/com/glavsoft/rfb/protocol/Protocol.java --- 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 diff -r b038aafeb2b0 -r a204b53a30c7 src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java --- 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; diff -r b038aafeb2b0 -r a204b53a30c7 src/main/java/jp/ac/u_ryukyu/treevnc/TreeVncCommand.java --- 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 () { diff -r b038aafeb2b0 -r a204b53a30c7 src/main/java/jp/ac/u_ryukyu/treevnc/server/TreeManagement.java --- 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(); diff -r b038aafeb2b0 -r a204b53a30c7 src/main/java/jp/ac/u_ryukyu/treevnc/server/TreeVNCNode.java --- 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; + } + }