Mercurial > hg > Applications > TreeVNC
changeset 120:c1b14cef2704
MyRfb fix done.
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 26 May 2014 19:24:52 +0900 |
parents | f35479f25f4a |
children | e4408fc5679f |
files | src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java |
diffstat | 1 files changed, 8 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java Mon May 26 19:01:13 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java Mon May 26 19:24:52 2014 +0900 @@ -26,7 +26,7 @@ import com.glavsoft.transport.Writer; import com.glavsoft.viewer.ViewerImpl; -public class MyRfbProto { +public abstract class MyRfbProto { final static int FramebufferUpdateRequest = 3; final static int CheckDelay = 11; protected final static int FramebufferUpdate = 0; @@ -60,9 +60,7 @@ this.viewer = viewer; } - public boolean isRoot() { - return false; - } + abstract public boolean isRoot() ; public void newClient(AcceptThread acceptThread, final Socket newCli, final Writer os, final Reader is) throws IOException { @@ -613,15 +611,13 @@ reader.mark(dataLen+8); // +8 is serialnum reader.readBytes(serial.array(),0,8); serial.limit(8); - } + } reader.readBytes(header.array(), 0, 16); header.limit(16); if (header.get(0) == FramebufferUpdate) { int encoding = header.getInt(12); if (encoding == EncodingType.ZRLE.getId() - || encoding == EncodingType.ZLIB.getId()) { // ZRLEE is - // already - // recompressed + || encoding == EncodingType.ZLIB.getId()) { // ZRLEE is already compressed ByteBuffer len = multicastqueue.allocate(4); reader.readBytes(len.array(), 0, 4); len.limit(4); @@ -647,6 +643,7 @@ blen.flip(); bufs.addFirst(blen); bufs.addFirst(header); + this.addSerialNumber(bufs); multicastqueue.put(bufs); if (!isRoot()) reader.reset(); } catch (DataFormatException e) { @@ -656,8 +653,6 @@ } return; } - if (!isRoot()) - bufs.add(serial); bufs.add(header); if (dataLen > 16) { ByteBuffer b = multicastqueue.allocate(dataLen - 16); @@ -665,11 +660,12 @@ b.limit(dataLen - 16); bufs.add(b); } + this.addSerialNumber(bufs); multicastqueue.put(bufs); + if (!isRoot()) reader.reset(); return; } - if (isRoot()) - reader.reset(); + if (isRoot()) reader.reset(); // It may be compressed. We can inflate here to avoid repeating clients // decompressing here, // but it may generate too many large data. It is better to do it in