Mercurial > hg > Members > riono > TreeVNC_ja_comment
changeset 247:dd154ffe1a53
fix lostparent, in case of death last node.
author | one@firefly.cr.ie.u-ryukyu.ac.jp |
---|---|
date | Tue, 21 Oct 2014 10:13:51 +0900 |
parents | 5a09805898d2 |
children | e6abf4b0c92e |
files | src/main/java/jp/ac/u_ryukyu/treevnc/TreeManagement.java src/main/java/jp/ac/u_ryukyu/treevnc/TreeVncProtocol.java src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java |
diffstat | 3 files changed, 9 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- 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); } }
--- 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 {
--- 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() { /**