mirror of
https://github.com/i2p/i2p.i2p.git
synced 2024-12-06 19:27:00 +01:00
I2CP: Send DestroySessionMessage with dummy SessionID if unset
rather than throwing I2CPMessageException ref: https://www.reddit.com/r/i2p/comments/1dp7j98/automatically_restarting_i2psnark/
This commit is contained in:
@@ -175,7 +175,10 @@ class I2CPMessageProducer {
|
||||
public void disconnect(I2PSessionImpl session) throws I2PSessionException {
|
||||
if (session.isClosed()) return;
|
||||
DestroySessionMessage dmsg = new DestroySessionMessage();
|
||||
dmsg.setSessionId(session.getSessionId());
|
||||
SessionId id = session.getSessionId();
|
||||
if (id == null)
|
||||
id = I2PSessionImpl.DUMMY_SESSION;
|
||||
dmsg.setSessionId(id);
|
||||
session.sendMessage_unchecked(dmsg);
|
||||
// use DisconnectMessage only if we fail and drop connection...
|
||||
// todo: update the code to fire off DisconnectMessage on socket error
|
||||
|
||||
@@ -256,7 +256,7 @@ public abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2
|
||||
public static final int LISTEN_PORT = I2PClient.DEFAULT_LISTEN_PORT;
|
||||
|
||||
private static final int BUF_SIZE = 32*1024;
|
||||
private static final SessionId DUMMY_SESSION = new SessionId(65535);
|
||||
static final SessionId DUMMY_SESSION = new SessionId(65535);
|
||||
|
||||
/**
|
||||
* for extension by SimpleSession (no dest)
|
||||
@@ -1180,6 +1180,7 @@ public abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2
|
||||
|
||||
/**
|
||||
* Retrieve the session's ID
|
||||
* @return null if unset
|
||||
*/
|
||||
SessionId getSessionId() { return _sessionId; }
|
||||
void setSessionId(SessionId id) { _sessionId = id; }
|
||||
|
||||
Reference in New Issue
Block a user