# HG changeset patch # User ryokka # Date 1584875061 -32400 # Node ID 710c26fd3ebeb2184edf4edcbd86f23af2b6c29a # Parent c67f0f6eae907778589aa0e96df1b34584737379 fix send lost parent state to root diff -r c67f0f6eae90 -r 710c26fd3ebe Todo.txt --- a/Todo.txt Sun Mar 22 19:17:07 2020 +0900 +++ b/Todo.txt Sun Mar 22 20:04:21 2020 +0900 @@ -1,3 +1,9 @@ +Sun Mar 22 19:18:07 JST 2020 + connect to は Viewer にある + 接続に失敗したら lost parent を実行する + parent が生きてても lost parent を尊重する方向でいく + + Mon Mar 9 18:29:02 JST 2020 Broadcast で統一する diff -r c67f0f6eae90 -r 710c26fd3ebe src/main/java/jp/ac/u_ryukyu/treevnc/TreeManagement.java --- a/src/main/java/jp/ac/u_ryukyu/treevnc/TreeManagement.java Sun Mar 22 19:17:07 2020 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/TreeManagement.java Sun Mar 22 20:04:21 2020 +0900 @@ -88,7 +88,10 @@ */ public void fixLostParent(String hostname, int port, String myHostName) { TreeVNCNode lostParentNode = lookup(nodeList,hostname,port); - if (lostParentNode == null ) return; // something wrong + if (lostParentNode == null ) { + // add list and reconfiguration necessary + return; // something wrong + } int treeNumber = lostParentNode.getTreeNum(); TreeVNCNode deadParent = getParentNode(treeNumber); TreeVNCNode me = nodeList.getFirst(); diff -r c67f0f6eae90 -r 710c26fd3ebe src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java --- a/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java Sun Mar 22 19:17:07 2020 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java Sun Mar 22 20:04:21 2020 +0900 @@ -167,12 +167,7 @@ int myHostPort = 0; clients = myId; if (!isTreeManager) { - rootHostName = getConnectionParam().getHostName(); - rootHostPort = getConnectionParam().getPort(); - myHostName = getMyAddress(); - myHostPort = getAcceptPort(); - TreeVncProtocol echo = new TreeVncProtocol(rootHostName, rootHostPort); - echo.lostChild(myHostName, myHostPort, myId); + sendLostChild(myId); } else { getTreeManager(intf).fixLostChild1(myId + 1); } @@ -358,6 +353,33 @@ new Thread(sender, "writer-to-lower-node").start(); } + private void sendLostChild(int myId) { + String rootHostName; + int rootHostPort; + String myHostName; + int myHostPort; + rootHostName = getConnectionParam().getHostName(); + rootHostPort = getConnectionParam().getPort(); + myHostName = getMyAddress(); + myHostPort = getAcceptPort(); + TreeVncProtocol echo = new TreeVncProtocol(rootHostName, rootHostPort); + echo.lostChild(myHostName, myHostPort, myId); + } + + public void sendLostParent() { + String rootHostName; + int rootHostPort; + String myHostName; + int myHostPort; + rootHostName = getConnectionParam().getHostName(); + rootHostPort = getConnectionParam().getPort(); + myHostName = getMyAddress(); + myHostPort = getAcceptPort(); + TreeVncProtocol echo = new TreeVncProtocol(rootHostName, rootHostPort); + echo.lostParent(myHostName, myHostPort); + } + + public boolean permitChangeScreen() { return permitChangeScreen; } diff -r c67f0f6eae90 -r 710c26fd3ebe src/viewer_swing/java/com/glavsoft/viewer/ConnectionPresenter.java --- a/src/viewer_swing/java/com/glavsoft/viewer/ConnectionPresenter.java Sun Mar 22 19:17:07 2020 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/ConnectionPresenter.java Sun Mar 22 20:04:21 2020 +0900 @@ -181,7 +181,13 @@ public void connectionFailed() { cancelConnection(); - if (isTreeVNC) return; + if (isTreeVNC) { + // send lost parent to root + if (viewer != null && viewer.getRfb() != null){ + viewer.getRfb().sendLostParent(); + } + return; + } if (allowInteractive) { enableConnectionDialog(); } else {