Streaming: Throw I2PSocketException when connection is reset,

display new error page in HTTP client (ticket #643)
javadocs
This commit is contained in:
zzz
2015-03-24 14:33:36 +00:00
parent a975dc4427
commit 9e18c7ea18
10 changed files with 112 additions and 16 deletions

View File

@ -12,6 +12,7 @@ import java.util.concurrent.atomic.AtomicLong;
import net.i2p.I2PAppContext;
import net.i2p.client.I2PSession;
import net.i2p.client.streaming.I2PSocketException;
import net.i2p.data.DataHelper;
import net.i2p.data.Destination;
import net.i2p.util.Log;
@ -606,7 +607,7 @@ class Connection {
public void resetReceived() {
if (!_resetReceived.compareAndSet(false, true))
return;
IOException ioe = new IOException("Reset received");
IOException ioe = new I2PSocketException(I2PSocketException.STATUS_CONNECTION_RESET);
_outputStream.streamErrorOccurred(ioe);
_inputStream.streamErrorOccurred(ioe);
_connectionError = "Connection reset";

View File

@ -262,9 +262,12 @@ class ConnectionManager {
// Ditto for blacklist / whitelist
// This is a tradeoff, because it will keep retransmitting the SYN for a while,
// thus more inbound, but let's not spend several KB on the outbound.
if (_log.shouldLog(Log.INFO))
_log.info("Dropping RST to " + h);
return null;
if (!Boolean.valueOf(_context.getProperty("i2p.streaming.sendResetOnBlock"))) {
// this is the default. Set property to send reset for debugging.
if (_log.shouldLog(Log.INFO))
_log.info("Dropping RST to " + h);
return null;
}
}
}
PacketLocal reply = new PacketLocal(_context, from);