# HG changeset patch # User Shinji KONO # Date 1312514143 -32400 # Node ID 6f95e5efa7991c1f7cb0c1a87accc1c2f3eeeb62 # Parent 3f73ebf918bd9ccf5bbcdf815b7e36ee73d0e3d9 writer living flag diff -r 3f73ebf918bd -r 6f95e5efa799 src/myVncProxy/MyRfbProto.java --- a/src/myVncProxy/MyRfbProto.java Fri Aug 05 12:08:17 2011 +0900 +++ b/src/myVncProxy/MyRfbProto.java Fri Aug 05 12:15:43 2011 +0900 @@ -649,9 +649,10 @@ try { synchronized(this) { wait(timeout); + writerRunning.set(false); while (!writerRunning.get()) { c.poll(); // discard, should be timeout - wait(10); + wait(10); // if this is too short, writer cannot take the poll, if this is too long, memory will overflow... } } } catch (InterruptedException e) { @@ -703,6 +704,7 @@ System.out.println("client "+ myId); } writeToClient(os, bufs, inputIndex); + writerRunning.set(true); } } catch (IOException e) { try {