# HG changeset patch # User one@firefly.cr.ie.u-ryukyu.ac.jp # Date 1413854031 -32400 # Node ID dd154ffe1a534d91f6a1e6e106ff4ca52ded12aa # Parent 5a09805898d2a7ce3c59a549b9c581ce099d0808 fix lostparent, in case of death last node. diff -r 5a09805898d2 -r dd154ffe1a53 src/main/java/jp/ac/u_ryukyu/treevnc/TreeManagement.java --- a/src/main/java/jp/ac/u_ryukyu/treevnc/TreeManagement.java Thu Oct 16 18:45:48 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/TreeManagement.java Tue Oct 21 10:13:51 2014 +0900 @@ -96,7 +96,7 @@ /** * send reconnect to all children - * @param newparent + * @param oldParent */ private void lostNodeConnection(TreeVNCNode oldParent) { TreeVNCNode newparent = nodeList.get(oldParent.getTreeNum()); @@ -125,6 +125,10 @@ vc1.connectTo(newparent.getHostname(), newparent.getPort(), isLeader(n), nodeId); } catch (IOException e) { // log + System.out.println("can't connectTo : port = " + n.getPort() + ", addr = " + n.getHostname()); + if (getChildNode(n, 0) == null) return; + moveLastNodeToLostNodePosition(n.getTreeNum()); + lostNodeConnection(n); } } diff -r 5a09805898d2 -r dd154ffe1a53 src/main/java/jp/ac/u_ryukyu/treevnc/TreeVncProtocol.java --- a/src/main/java/jp/ac/u_ryukyu/treevnc/TreeVncProtocol.java Thu Oct 16 18:45:48 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/TreeVncProtocol.java Tue Oct 21 10:13:51 2014 +0900 @@ -18,19 +18,12 @@ this.rootAddress = name; } - public void openport() { - try { + public void openport() throws IOException { echoSocket = new Socket(rootAddress, rootPort); // echoSocket.setReuseAddress(true); os = new DataOutputStream(echoSocket.getOutputStream()); is = new BufferedReader(new InputStreamReader( echoSocket.getInputStream())); - } catch (UnknownHostException e) { - System.err.println("Don't know about host: "+rootAddress); - } catch (IOException e) { - System.out.println(rootAddress + " Connection Faild"); - System.exit(0); - } } public void findRootReply(int port) throws IOException { diff -r 5a09805898d2 -r dd154ffe1a53 src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java --- a/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java Thu Oct 16 18:45:48 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java Tue Oct 21 10:13:51 2014 +0900 @@ -151,6 +151,9 @@ return surface.getPreferredSize(); } }; + Dimension outerPanelSize = outerPanel.getSize(); + double width = outerPanel.getSize().getWidth(); + double height = outerPanelSize.getHeight(); outerPanel.setBackground(Color.DARK_GRAY); lpane = new JLayeredPane() { /**