Mercurial > hg > Members > nobuyasu > tightVNCProxy
changeset 99:0c5762c3a8dd
Test and VNC not working... Memory Overflow...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 03 Aug 2011 21:35:06 +0900 |
parents | 3db7ac2b10f7 |
children | ae4df9b07805 |
files | src/myVncProxy/MyRfbProto.java |
diffstat | 1 files changed, 11 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/myVncProxy/MyRfbProto.java Wed Aug 03 20:55:15 2011 +0900 +++ b/src/myVncProxy/MyRfbProto.java Wed Aug 03 21:35:06 2011 +0900 @@ -64,8 +64,8 @@ byte[] pngBytes; - // private MulticastQueue<LinkedList<ByteBuffer>> multicastqueue = new MostRecentMultiCast<LinkedList<ByteBuffer>>(10); - private MulticastQueue<LinkedList<ByteBuffer>> multicastqueue = new MulticastQueue<LinkedList<ByteBuffer>>(); + private MulticastQueue<LinkedList<ByteBuffer>> multicastqueue = new MostRecentMultiCast<LinkedList<ByteBuffer>>(10); + // private MulticastQueue<LinkedList<ByteBuffer>> multicastqueue = new MulticastQueue<LinkedList<ByteBuffer>>(); private int clients = 0; private Inflater inflater = new Inflater(); @@ -583,6 +583,7 @@ inflater.setInput(input.array(),0,input.limit()); do { len0 = inflater.inflate(buf.array(),buf.position(),buf.remaining()); + if (len0<=0) break; buf.position(buf.position()+len0); len += len0; if (buf.remaining()==0) { @@ -596,7 +597,7 @@ buf.flip(); outputs.addLast(buf); } - inflater.reset(); + // inflater.reset(); // this make JUnit happy, but VNC won't happy with this return len; } @@ -741,14 +742,15 @@ zip(deflater,in,0,out); // LinkedList<ByteBuffer> out3 = clone(out); zipped result is depend on deflator's state unzip(inflater, out, 0,out2); + inflater.reset(); equalByteBuffers(in1, out2); LinkedList<ByteBuffer> out4 = new LinkedList<ByteBuffer>(); zip(deflater,out2,0,out4); LinkedList<ByteBuffer> out5 = new LinkedList<ByteBuffer>(); unzip(inflater,out4,0, out5); - equalByteBuffers(in1,out5); + int len = equalByteBuffers(in1,out5); - System.out.println("Test Ok."); + System.out.println("Test Ok. "+len); } catch (Exception e) { assertEquals(0,1); } @@ -765,12 +767,14 @@ - public void equalByteBuffers(LinkedList<ByteBuffer> in, + public int equalByteBuffers(LinkedList<ByteBuffer> in, LinkedList<ByteBuffer> out2) { + int len = 0; Iterable<Byte> i = byteBufferIterator(in); Iterator<Byte> o = byteBufferIterator(out2).iterator(); for(int b: i) { + len ++; if (o.hasNext()) { int c = o.next(); assertEquals(b,c); @@ -779,6 +783,7 @@ } if (o.hasNext()) assertEquals(0,1); // System.out.println(); + return len; } private Iterable<Byte> byteBufferIterator(final LinkedList<ByteBuffer> in) {