I2CP: Prevent sending data message before handshake with router is complete

This commit is contained in:
zzz
2015-05-30 14:02:38 +00:00
parent 280fc05c91
commit 94824e4d2b
3 changed files with 6 additions and 0 deletions

View File

@ -619,6 +619,8 @@ public abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2
throw new I2PSessionException("Already closed");
if (_state == State.INIT)
throw new I2PSessionException("Not open, must call connect() first");
if (_state == State.OPENING) // not before GOTDATE
throw new I2PSessionException("Session not open yet");
}
_producer.reportAbuse(this, msgId, severity);
}

View File

@ -252,6 +252,8 @@ class I2PSessionImpl2 extends I2PSessionImpl {
throw new I2PSessionException("Already closed");
if (_state == State.INIT)
throw new I2PSessionException("Not open, must call connect() first");
if (_state == State.OPENING || _state == State.GOTDATE) // not before GOTDATE or session
throw new I2PSessionException("Session not open yet");
}
updateActivity();

View File

@ -261,6 +261,8 @@ class I2PSessionMuxedImpl extends I2PSessionImpl2 {
throw new I2PSessionException("Already closed");
if (_state == State.INIT)
throw new I2PSessionException("Not open, must call connect() first");
if (_state == State.OPENING || _state == State.GOTDATE) // not before GOTDATE or session
throw new I2PSessionException("Session not open yet");
}
updateActivity();