Mercurial > hg > Applications > TreeVNC
changeset 203:2f6237fea67e
change createTreeManagers timing.
author | oc |
---|---|
date | Fri, 27 Jun 2014 19:40:46 +0900 |
parents | 22676ca0dd97 |
children | d9d234715853 |
files | src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java src/viewer_swing/java/com/glavsoft/viewer/Viewer.java |
diffstat | 2 files changed, 17 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java Fri Jun 27 19:21:18 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java Fri Jun 27 19:40:46 2014 +0900 @@ -57,7 +57,6 @@ ViewerInterface viewer; private short id; // my tree node id ( = 0 in root ) private boolean leader; - public TreeManagement treeManager; private TreeVncCommandChannelListener acceptThread; private boolean firstTime = true; private TreeRootFinderListener getCast; @@ -65,7 +64,8 @@ private boolean hasViewer = false; private boolean reconnecting; private short reconnectingId; // Change Server Request to id's node VNC server - private HashMap<NetworkInterface, TreeManagement> interfaces = new HashMap<NetworkInterface, TreeManagement>(); + private HashMap<String, TreeManagement> interfaces = new HashMap<String, TreeManagement>(); + private String vncInterface; public MyRfbProto() { @@ -362,6 +362,7 @@ Socket vncSocket = viewer.getVNCSocket(); NetworkInterface ni = getInterface(vncSocket); if (ni!=null) { + vncInterface = ni.getName(); System.out.println("VNCNetworkInterface :" + ni.getName()); } sendDesktopSizeChange(reconnectingId); @@ -624,12 +625,12 @@ return leader; } - public void setTreeManager(TreeManagement clients) { - treeManager = clients; + public void setTreeManager(String intf, TreeManagement clients) { + interfaces.put(intf, clients); } - public TreeManagement getTreeManager() { - return treeManager; + public TreeManagement getTreeManager(String intf) { + return interfaces.get(intf); } /** @@ -664,9 +665,7 @@ */ public void createConnectionAndStart(ViewerInterface v) { selectPort(ConnectionParams.DEFAULT_VNC_ROOT); - if (treeManager!=null) { - treeManager.getList().getFirst().setPort(getAcceptPort()); - } + createTreeManagers(); startTreeVncCommandListener(); if(isTreeManager() && firstTime) { getCast = new TreeRootFinderListener(v); @@ -676,7 +675,14 @@ } } - public void startTreeVncCommandListener() { + private void createTreeManagers() { + setTreeManager(new TreeManagement(hostName, ConnectionParams.DEFAULT_VNC_ROOT, showTree)); + if (treeManager!=null) { + treeManager.getList().getFirst().setPort(getAcceptPort()); + } + } + + public void startTreeVncCommandListener() { acceptThread = new TreeVncCommandChannelListener(this, getAcceptPort()); Thread thread = new Thread(acceptThread, "TreeVNC-accept"); thread.start(); @@ -722,7 +728,7 @@ } private void addNetworkInterface(NetworkInterface ni, TreeManagement treeManager) { - interfaces.put(ni, treeManager); + interfaces.put(ni.getName(), treeManager); }
--- a/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java Fri Jun 27 19:21:18 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java Fri Jun 27 19:40:46 2014 +0900 @@ -382,7 +382,6 @@ MyRfbProtoProxy rfb = new MyRfbProtoProxy(); myRfb = rfb; rfb.setShowTree(showTree); - rfb.setTreeManager(new TreeManagement(hostname, ConnectionParams.DEFAULT_VNC_ROOT, rfb.showTreeNode)); rfb.setViewer(this); rfb.setCuiVersion(false); rfb.setHasViewer(true); @@ -396,7 +395,6 @@ } public void initRoot(MyRfbProto myRfbProto, String hostName) { - myRfbProto.setTreeManager(new TreeManagement(hostName, ConnectionParams.DEFAULT_VNC_ROOT, showTree)); setIsTreeVNC(true); connectionParams.setConnectionParam(hostName, vncport); isApplet = true;