Mercurial > hg > Members > riono > TreeVNC_ja_comment
diff src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java @ 369:2d01ec1c02d2
Fix ReConnectingFlag
author | innparusu |
---|---|
date | Sat, 15 Aug 2015 17:28:19 +0900 |
parents | 0e3af3c8b771 |
children | 2c61e6d434ff |
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java Sat Aug 15 04:21:33 2015 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java Sat Aug 15 17:28:19 2015 +0900 @@ -6,6 +6,7 @@ import java.net.*; import java.nio.ByteBuffer; import java.nio.ByteOrder; +import java.util.Enumeration; import java.util.Iterator; import java.util.LinkedList; import java.util.concurrent.atomic.AtomicInteger; @@ -46,7 +47,6 @@ private TreeVncCommandChannelListener acceptThread; private TreeRootFinderListener getCast; private CreateConnectionParam cp; - private short reconnectingId; // Change Server Request to id's node VNC server private TreeVNCNetwork nets = new TreeVNCNetwork(); private TreeVncRootSelectionPanel rootSelectionPanel; private String vncInterface; @@ -57,7 +57,6 @@ private boolean permitChangeScreen = true; private boolean leader; private boolean hasViewer = false; - private boolean reconnecting; private boolean normalTermination; private boolean isTreeManager; public boolean showTreeNode = false; @@ -481,37 +480,30 @@ public synchronized void vncConnected(boolean ready) { enableChildrenTransmission(); - if (ready && reconnecting) { - printNetworkInterface(); - sendDesktopSizeChange(reconnectingId); - reconnecting = false; - /* - if (reconnectingId == 0) { - viewer.setVisible(false); - } - */ - } - if (reconnectingId!=0) { - readyReconnect = ready; - if (ready) { - notifyAll(); - } + readyReconnect = ready; + if (ready) { + notifyAll(); } } - private void printNetworkInterface() { + public void printNetworkInterface() { Socket vncSocket = viewer.getVNCSocket(); NetworkInterface ni = nets.getInterface(vncSocket); if (ni!=null) { vncInterface = ni.getName(); - System.out.println("VNCNetworkInterface :" + vncInterface); + System.out.print("VNCNetworkInterface :" + vncInterface); + Enumeration<InetAddress> addresses = ni.getInetAddresses(); + while(addresses.hasMoreElements()) { + InetAddress adr = addresses.nextElement(); + System.out.print(" "+adr); + } + System.out.println(); } } public synchronized void waitForVNCConnection() { - if (reconnectingId!=0) { - while (!readyReconnect) { + while (!readyReconnect) { try { wait(); } catch (InterruptedException e) { @@ -519,9 +511,6 @@ System.out.println("interrupt wait for vnc connection."); } } - } else { - System.out.println("changeVNCServer : got recconectionId == 0"); - } } @@ -831,13 +820,9 @@ return; } // serverChangeの処理 - reconnectingId = newVNCServerId; - vncProxyService.inhelitClients(vncProxyService, hostName); + vncProxyService.inhelitClients(vncProxyService, hostName, newVNCServerId); // after connecting VNC server, rfb send SEND_INIT_DATA command and wakes me up if necessary - reconnecting = true; // stop reader stop - stopReceiverTask(); - waitForVNCConnection(); } /** @@ -875,14 +860,6 @@ hasViewer = b; } - public void setReconnecting(boolean b) { - reconnecting = b; - } - - public int getReconnectingId() { - return reconnectingId; - } - public void setShowTree(boolean showTree) { this.showTreeNode = showTree; }