Streaming Library should throw java.io.EOFException when the underlying stream is closed
There are a few places in the streaming library with code like this:
MessageInputStream.java:419:
while (_readyDataBlocks.isEmpty()) {
if (_locallyClosed)
throw new IOException("Input stream closed");
This code should be changed to:
while (_readyDataBlocks.isEmpty()) {
if (_locallyClosed)
throw new EOFException("Input stream closed");
See also: MessageInputStream.java:411 MessageInputStream.java:520
See also the corresponding methods in MessageOutputStream.java.
In I2PSocket we can also use the more specific EOFException to indicate that a Socket has been closed: I2PSocketFull.java:107 I2PSocketFull.java:139
Generally the idea is to raise an EOFException instead of the more generic IOException whenever the underlying Socket or Stream has been closed (and can never be reopened). This allows client code working with the Sockets and Streams to distinguish the case where a socket or stream has been closed from the case where unexpected data has been receieved.