i2ptunnel: Propagate resets from streaming to Socket and vice versa (ticket #2071)

This commit is contained in:
zzz
2017-12-02 23:12:19 +00:00
parent 3d0e15aaed
commit 100d307037
6 changed files with 164 additions and 54 deletions

View File

@ -200,8 +200,11 @@ class Connection {
// no need to wait until the other side has ACKed us before sending the first few wsize
// packets through
// Incorrect assumption, the constructor defaults _connected to true --Sponge
if (!_connected.get())
if (!_connected.get()) {
if (getResetReceived())
throw new I2PSocketException(I2PSocketException.STATUS_CONNECTION_RESET);
throw new IOException("disconnected");
}
if (_outputStream.getClosed())
throw new IOException("output stream closed");
started = true;

View File

@ -11,6 +11,7 @@ import net.i2p.data.Destination;
import net.i2p.data.SessionKey;
import net.i2p.data.SessionTag;
import net.i2p.data.SigningPrivateKey;
import net.i2p.client.streaming.I2PSocketException;
import net.i2p.util.Log;
import net.i2p.util.SimpleTimer2;
@ -321,8 +322,11 @@ class PacketLocal extends Packet implements MessageOutputStream.WriteStatus {
if ( (timeRemaining <= 0) && (maxWaitMs > 0) ) break;
synchronized (this) {
if (_ackOn > 0) break;
if (!_connection.getIsConnected())
if (!_connection.getIsConnected()) {
if (_connection.getResetReceived())
throw new I2PSocketException(I2PSocketException.STATUS_CONNECTION_RESET);
throw new IOException("disconnected");
}
if (_cancelledOn > 0)
throw new IOException("cancelled");
if (timeRemaining > 60*1000)