Mercurial > hg > Applications > TightVNC_orginal
changeset 47:f3b775d3592a
create newVps.
author | one |
---|---|
date | Thu, 06 Dec 2012 17:51:29 +0900 |
parents | d2741b80399e |
children | 6ebe870da138 |
files | .DS_Store doc/change VNCServer1.asta src/main/java/jp/ac/u_ryukyu/treevnc/server/VncProxyService.java src/viewer_swing/java/com/glavsoft/viewer/Viewer.java |
diffstat | 4 files changed, 43 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/server/VncProxyService.java Thu Dec 06 17:15:23 2012 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/server/VncProxyService.java Thu Dec 06 17:51:29 2012 +0900 @@ -55,6 +55,9 @@ public AcceptClient aClient; public int opendPort; + private VncProxyService prevVps; + static VncProxyService currentVps; + // public AcceptClient acc; private void initProxy(Parser parser) { @@ -76,6 +79,20 @@ } + public VncProxyService(VncProxyService vps, String hostName) { + this(); + connectionParams.hostName = hostName; + rfb = vps.rfb; + isClient = vps.isClient; + forceReconnection = vps.forceReconnection; + reconnectionReason = vps.reconnectionReason; + acceptThread = vps.acceptThread; + getCast = vps.getCast; + aClient = vps.aClient; + opendPort = vps.opendPort; + prevVps = vps; + } + public static void main(String[] argv) { String[] mainArgs = argv; System.out.println(mainArgs.length); @@ -118,9 +135,10 @@ private void setArguments(String[] mainArgs) { } + + + public boolean run1() { - @Override - public void run() { rfb = new MyRfbProtoProxy(); // getHostData(); if (forceReconnection) { @@ -166,8 +184,11 @@ updateFrameTitle(); containerFrame.dispose(); containerFrame = null; - if (tempWorkingProtocol != null) - tempWorkingProtocol.cleanUpSession(); + if (prevVps != null) { + prevVps.cleanUpSession(); + prevVps = null; + } + currentVps = this; workingProtocol.startNormalHandling(this, surface, clipboardController, rfb); // rfb.setInitData(workingProtocol.getInitData()); too early @@ -201,6 +222,15 @@ logger.severe(e.getMessage()); } } + return !tryAgain; + } + + private void cleanUpSession() { + if (prevVps != null) { + prevVps.cleanUpSession(); + prevVps = null; + } + workingProtocol.cleanUpSession(); } public void createConnectionAndStart() { @@ -336,12 +366,15 @@ public void changeVNCServer(String hostName) throws UnknownHostException, IOException { // sender and reader stop - tempWorkingProtocol = workingProtocol; + VncProxyService newVps = new VncProxyService(this,hostName); // run call and change workingProtocol - this.connectionParams.hostName = hostName; - this.run(); - this.createConnectionAndStart(); - createSocketAndSend(aClient.getList(), String.valueOf(opendPort)); + newVps.connectionParams.hostName = hostName; + if (newVps.run1()) { + newVps.createConnectionAndStart(); + newVps.createSocketAndSend(aClient.getList(), String.valueOf(opendPort)); + } else { + newVps.cleanUpSession(); + } } }
--- a/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java Thu Dec 06 17:15:23 2012 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java Thu Dec 06 17:51:29 2012 +0900 @@ -236,14 +236,11 @@ workingProtocol.cleanUpSession(); } cleanUpUISessionAndConnection(); - tryAgain = false; if (isApplet) { logger.severe("Applet is stopped."); isAppletStopped = true; repaint(); - } else { - System.exit(0); - } + } } @Override