Mercurial > hg > Applications > TreeVNC
changeset 581:aef7d24b430d
add dump
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 08 Feb 2020 06:24:26 +0900 |
parents | c7527f24e344 |
children | f01eef88010f |
files | src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEDecoder.java src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java |
diffstat | 2 files changed, 21 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEDecoder.java Fri Feb 07 22:56:41 2020 +0900 +++ b/src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEDecoder.java Sat Feb 08 06:24:26 2020 +0900 @@ -158,19 +158,18 @@ deflater.setInput(bytes, prevoffset, span); do { deflater.deflate(c1, Deflater. SYNC_FLUSH); - int bytesRead = (int)deflater.getBytesRead(); if (!deflater.needsInput()) { // compression failed flushDeflator(); prevoffset = flushOffset+(int)deflater.getBytesRead(); + assert(prevoffset==offset); + System.out.println("od prevOffset = "+prevoffset+" span = "+(prevoffset-flushOffset)); flushRectangle(rect); flushMuticast(rfb, bytes); - if (last && bytesRead == span) { + if (last) { return; } else { newMulticastPacket(rfb, rect); - deflater.setInput(bytes,prevoffset,offset - prevoffset); - deflater.deflate(c1, Deflater.NO_FLUSH); } } } while (! deflater.needsInput()); @@ -234,13 +233,13 @@ width = 0; } - private void flushMuticast(TreeRFBProto rfb, byte[] checkBytes) { + private void flushMuticast(TreeRFBProto rfb, byte[] bytes) { c1.flip(); //System.out.println("multicastPut: " + c1rect + " length: " + (c1.remaining()-c1headerPos-header.limit())); deflater.reset(); LinkedList<ByteBuffer> bufs = new LinkedList<ByteBuffer>(); bufs.add(c1); - rfb.getContext().checkFrameBufferRectanble(c1, checkBytes, flushOffset, prevoffset); + rfb.getContext().checkFrameBufferRectanble(c1, bytes, flushOffset, prevoffset); flushOffset = prevoffset; if (rfb.isTreeManager() && rfb.connectionPresenter.isUseMulticast()) { for (ByteBuffer buf : bufs)
--- a/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Fri Feb 07 22:56:41 2020 +0900 +++ b/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Sat Feb 08 06:24:26 2020 +0900 @@ -375,7 +375,7 @@ sendFrameBufferUpdateRequest(); } - public void checkFrameBufferRectanble(ByteBuffer c1, byte[] checkBytes, int flushOffset, int flushEnd) { + public void checkFrameBufferRectanble(ByteBuffer c1, byte[] bytes, int flushOffset, int flushEnd) { FramebufferUpdateRectangle rect = new FramebufferUpdateRectangle(); Reader in = new Reader(new ByteArrayInputStream(c1.array())); try { @@ -392,7 +392,7 @@ int zippedLength = (int) in.readUInt32(); ZRLEDecoder decoder = new ZRLEDecoder(); ByteBuffer buf = decoder.unzip(in, zippedLength, length, rect.getEncodingType()); - compareBytes(buf, checkBytes, flushOffset, flushEnd); + compareBytes(buf, bytes, flushOffset, flushEnd); } in.reset(); } @@ -409,12 +409,24 @@ } } - private void compareBytes(ByteBuffer buf, byte[] unCompressBytes, int flushOffset, int flushEnd) { + private void compareBytes(ByteBuffer buf, byte[] bytes, int flushOffset, int flushEnd) { int span = flushEnd - flushOffset; if (buf.remaining() == span) { }else { - System.out.println("Bytes is not equal length "+buf.remaining()+" != "+span + " " + (buf.remaining() - span)); + System.out.println("Bytes is not equal length "+buf.remaining()+" - "+span + " = " + (buf.remaining() - span)); + } + dump("in ",bytes,flushOffset,8); dump("... ",bytes,flushEnd-8,8); + System.out.println(); + dump("out ",buf.array(),buf.position(),8); dump(" ",buf.array(),buf.limit()-8,8); + System.out.println(); + } + + private void dump(String s, byte[] bytes, int begin, int len) { + System.out.print(s); + while(len > 0 && begin < bytes.length) { + System.out.print(bytes[begin] + " "); + begin ++ ; len--; } }