2005-12-22 jrandom

* Cleaned up some buffer synchronization issues in I2PSnark that could
       cause blockage.
This commit is contained in:
jrandom
2005-12-22 10:04:12 +00:00
committed by zzz
parent 98277d3b64
commit 148dd99c86
8 changed files with 31 additions and 17 deletions

View File

@ -180,7 +180,10 @@ public class Peer implements Comparable
InputStream in = sock.getInputStream();
OutputStream out = sock.getOutputStream(); //new BufferedOutputStream(sock.getOutputStream());
if (true) {
out = new BufferedOutputStream(out);
// buffered output streams are internally synchronized, so we can't get through to the underlying
// I2PSocket's MessageOutputStream to close() it if we are blocking on a write(...). Oh, and the
// buffer is unnecessary anyway, as unbuffered access lets the streaming lib do the 'right thing'.
//out = new BufferedOutputStream(out);
in = new BufferedInputStream(sock.getInputStream());
}
//BufferedInputStream bis