* make sure we send the close message even if the I2PSocket is closed directly (rather than the outputStream)
* only fail the session tags as a last resort for the last resend, rather than on every resend after the 1st
This commit is contained in:
@ -758,8 +758,12 @@ public class Connection {
|
||||
|
||||
// in case things really suck, the other side may have lost thier
|
||||
// session tags (e.g. they restarted), so jump back to ElGamal.
|
||||
if ( (newWindowSize == 1) && (numSends > 2) )
|
||||
int failTagsAt = _options.getMaxResends() - 1;
|
||||
if ( (newWindowSize == 1) && (numSends == failTagsAt) ) {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Optimistically failing tags at resend " + numSends);
|
||||
_context.sessionKeyManager().failTags(_remotePeer.getPublicKey());
|
||||
}
|
||||
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Resend packet " + _packet + " time " + numSends +
|
||||
|
@ -19,12 +19,13 @@ public class I2PSocketFull implements I2PSocket {
|
||||
}
|
||||
|
||||
public void close() throws IOException {
|
||||
if (_connection == null) return;
|
||||
if (_connection.getIsConnected()) {
|
||||
OutputStream out = _connection.getOutputStream();
|
||||
Connection c = _connection;
|
||||
if (c == null) return;
|
||||
if (c.getIsConnected()) {
|
||||
OutputStream out = c.getOutputStream();
|
||||
if (out != null)
|
||||
out.close();
|
||||
_connection.disconnect(true);
|
||||
c.disconnect(true);
|
||||
} else {
|
||||
//throw new IOException("Not connected");
|
||||
}
|
||||
|
Reference in New Issue
Block a user