Mercurial > hg > Members > nobuyasu > tightVNCProxy
changeset 162:13458f88d8c9
add RequestScreenThread.java
author | e085711 |
---|---|
date | Wed, 12 Oct 2011 06:45:04 +0900 |
parents | 1fdee3cb0908 |
children | 28cd6a6c524d 3c055da4d050 |
files | src/myVncProxy/MyRfbProto.java src/myVncProxy/RequestScreenThread.java src/myVncProxy/VncProxyService.java |
diffstat | 3 files changed, 68 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/myVncProxy/MyRfbProto.java Wed Oct 12 02:52:13 2011 +0900 +++ b/src/myVncProxy/MyRfbProto.java Wed Oct 12 06:45:04 2011 +0900 @@ -71,6 +71,9 @@ private Inflater inflater = new Inflater(); private Deflater deflater = new Deflater(); private CreateThread geth; +// private Thread requestThread; + private RequestScreenThread rThread; + private Thread requestThread; public MyRfbProto() throws IOException { @@ -78,18 +81,30 @@ MyRfbProto(String h, int p, VncViewer v) throws IOException { super(h, p, v); + + rThread = new RequestScreenThread(this); + requestThread = new Thread(rThread); +// requestThread = new Thread(new RequestScreenThread(this)); } MyRfbProto(String h, int p, CreateThread geth) throws IOException { super(h, p); this.geth = geth; proxyFlag = true; + + rThread = new RequestScreenThread(this); + requestThread = new Thread(rThread); +// requestThread = new Thread(new RequestScreenThread(this)); } MyRfbProto(String h, int p) throws IOException { super(h, p); + + rThread = new RequestScreenThread(this); + requestThread = new Thread(rThread); +// requestThread = new Thread(new RequestScreenThread(this)); } - + // over write void writeVersionMsg() throws IOException { clientMajor = 3; @@ -514,6 +529,15 @@ new Thread(stdin).start(); } + + void requestThreadStart() { + requestThread.start(); + } + + public synchronized void requestThreadNotify() { + rThread.reStart(); + } + /** * gzip byte arrays @@ -762,7 +786,8 @@ readClientInit(is); sendInitData(os); new Thread(reader).start(); // discard incoming packet here after. - writeFramebufferUpdateRequest(0,0, framebufferWidth, framebufferHeight, false ); +// writeFramebufferUpdateRequest(0,0, framebufferWidth, framebufferHeight, false ); + requestThreadNotify(); for (;;) { LinkedList<ByteBuffer> bufs = c.poll(); int inputIndex = 0;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/myVncProxy/RequestScreenThread.java Wed Oct 12 06:45:04 2011 +0900 @@ -0,0 +1,38 @@ +package myVncProxy; + +public class RequestScreenThread implements Runnable { + MyRfbProto rfb; + + RequestScreenThread(MyRfbProto _rfb) { + rfb = _rfb; + } + + public void run() { + while (true) { + try { + waitThread(); + Thread.sleep(3000); + rfb.writeFramebufferUpdateRequest(0, 0, rfb.framebufferWidth, + rfb.framebufferHeight, false); + + } catch (Exception e) { + e.printStackTrace(); + break; + } + } + } + + public synchronized void waitThread() { + try{ + wait(); + }catch(InterruptedException e) { + e.printStackTrace(); + } + } + + public synchronized void reStart() { + notify(); + } + + +}
--- a/src/myVncProxy/VncProxyService.java Wed Oct 12 02:52:13 2011 +0900 +++ b/src/myVncProxy/VncProxyService.java Wed Oct 12 06:45:04 2011 +0900 @@ -144,7 +144,7 @@ rfb.selectPort(5999); rfbThread = new Thread(this); accThread = new Thread(new AcceptThread(rfb, 5999)); - + /* if(url != null) { try { @@ -181,6 +181,8 @@ public void start_threads(){ rfbThread.start(); accThread.start(); + rfb.requestThreadStart(); + } //