Mercurial > hg > Applications > TreeVNC
changeset 142:d2af9edb1803
fix selectRfbSelectPort.
author | oc |
---|---|
date | Thu, 12 Jun 2014 18:04:22 +0900 |
parents | 1fa40e04f099 |
children | 4547543ca73c |
files | src/main/java/jp/ac/u_ryukyu/treevnc/AcceptThread.java src/main/java/jp/ac/u_ryukyu/treevnc/CreateConnectionParam.java src/main/java/jp/ac/u_ryukyu/treevnc/server/VncProxyService.java |
diffstat | 3 files changed, 7 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/AcceptThread.java Thu Jun 12 05:38:36 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/AcceptThread.java Thu Jun 12 18:04:22 2014 +0900 @@ -11,11 +11,6 @@ byte[] imageBytes; int port; - public AcceptThread(MyRfbProto _rfb) { - rfb = _rfb; - } - - public AcceptThread(MyRfbProto _rfb, int p) { rfb = _rfb; port = p; @@ -26,8 +21,6 @@ } public void run() { - rfb.selectPort(port); - while (true) { try { Socket newCli = rfb.accept();
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/CreateConnectionParam.java Thu Jun 12 05:38:36 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/CreateConnectionParam.java Thu Jun 12 18:04:22 2014 +0900 @@ -17,7 +17,7 @@ this.rfb = rfb; } - public void findTreeVncRoot() throws InterruptedException { + public synchronized void findTreeVncRoot() throws InterruptedException { FindRoot getBcast = new FindRoot(rfb.acceptPort,this); getBcast.findRoot(); // wait for RootSelection @@ -40,7 +40,10 @@ } public void runAcceptThread() { - Thread accThread = new Thread(new AcceptThread(rfb, portNumber)); + rfb.selectPort(ConnectionParams.DEFAULT_VNC_ROOT); + AcceptThread acceptThread = new AcceptThread(rfb, rfb.getAcceptPort()); + portNumber = rfb.getAcceptPort(); + Thread accThread = new Thread(acceptThread); accThread.start(); }
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/server/VncProxyService.java Thu Jun 12 05:38:36 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/server/VncProxyService.java Thu Jun 12 18:04:22 2014 +0900 @@ -33,7 +33,6 @@ private AcceptThread acceptThread; private TreeRootFinderListener getCast; private AcceptClient clients; - public int opendPort; static VncProxyService currentVps; private int fbWidth = 0; private boolean firstTime = true; @@ -54,7 +53,6 @@ acceptThread = vps.acceptThread; getCast = vps.getCast; clients = vps.clients; - opendPort = vps.opendPort; } public static void main(String[] argv) { @@ -107,8 +105,8 @@ * run rootFinderListener if necessary */ public void createConnectionAndStart() { - opendPort = myRfb.selectPort(ConnectionParams.DEFAULT_VNC_ROOT); - acceptThread = new AcceptThread(myRfb, opendPort); + myRfb.selectPort(ConnectionParams.DEFAULT_VNC_ROOT); + acceptThread = new AcceptThread(myRfb, myRfb.getAcceptPort()); Thread thread = new Thread(acceptThread, "TreeVNC-accept"); thread.start(); if(firstTime) {