java.lang.Object
net.i2p.router.transport.ntcp.EstablishBase
net.i2p.router.transport.ntcp.EstablishBase.FailedEstablishState
- All Implemented Interfaces:
EstablishState
- Enclosing class:
EstablishBase
Establish state that failed, to retry later.
Nested Class Summary
Nested classes/interfaces inherited from class EstablishBase
EstablishBase.StateModifier and TypeClassDescriptionprotected static enumStates for NTCP connection establishment process.Field Summary
Fields inherited from class EstablishBase
_con, _context, _failReason, _log, _peerSkew, _prevEncrypted, _received, _state, _stateLock, _transport, _X, _Y, AES_SIZE, FAILED, STATES_DONE, VERIFIEDModifier and TypeFieldDescriptionprotected final NTCPConnectionConnection being established by this handshake.protected final RouterContextRouter context, supplied to the subclass that constructs this.protected StringWhy the handshake failed, or null while it is still viable.protected final LogLog scoped to the subclass that constructs this.protected longOUR clock minus HIS clock, in seconds.protected byte[]Previously received encrypted block (or the IV).protected intBytes received so far.protected EstablishBase.StateCurrent handshake state, replaced under the state lock.protected final ObjectMonitor serialising every handshake state change.protected final NTCPTransportNTCP transport running this handshake.protected final byte[]Key block Bob receives and Alice sends, doubled as padding on inbound handshakes.protected final byte[]Key block Alice receives and Bob sends, null on outbound handshakes.protected static final intAES block and key size in bytes.static final EstablishBase.FailedEstablishStateShared instance marking a handshake that ended in corruption.protected static final Set<EstablishBase.State> The two terminal states, VERIFIED and CORRUPT.static final EstablishBase.VerifiedEstablishStateShared instance marking a handshake that completed and verified successfully.Constructor Summary
ConstructorsConstructorDescriptionStarts in the corrupt state, for a handshake that already failed.Method Summary
All MethodsModifier and TypeMethodDescriptionintThe NTCP 2 version.voidReject handshake preparation after failure.voidreceive(ByteBuffer src) Reject any data received after the handshake failed.toString()String representation of the failed state.Methods inherited from class EstablishBase
_x, changeState, close, fail, fail, fail, getFailReason, isComplete, isCorrupt, prefix, releaseBufs, storeFailCauseModifier and TypeMethodDescriptionprotected static final StringMarker function for i18n, returns the string unchanged.protected voidchangeState(EstablishBase.State state) Change the handshake state and update completion/corruption flags.voidRelease resources on timeout.protected voidFail the handshake.protected voidFail the handshake with exception.protected voidFail the handshake optionally suppressing skew stat.Failure reason if the handshake failed, or null if not failed/corrupt.booleanIf synchronized on this, fails with deadlocks from all over viaCSFI.isEstablished().booleanDid the handshake fail for some reason?protected Stringprefix()Logging prefix string.protected voidreleaseBufs(boolean isVerified) Only call once.(package private) static StringThe bare cause from a netdb store rejection, stripped of the "Invalid NetDbStore attempt" wrapper, capability flags and router ID.
Constructor Details
FailedEstablishState
public FailedEstablishState()Starts in the corrupt state, for a handshake that already failed.
Method Details
getVersion
public int getVersion()The NTCP 2 version.- Specified by:
getVersionin interfaceEstablishState- Specified by:
getVersionin classEstablishBase- Returns:
- 1, the NTCP 2 protocol version number
receive
Reject any data received after the handshake failed.- Specified by:
receivein interfaceEstablishState- Overrides:
receivein classEstablishBase- Parameters:
src- the buffer to parse- Throws:
IllegalStateException- always; the state is already corrupt
prepareOutbound
public void prepareOutbound()Reject handshake preparation after failure.- Specified by:
prepareOutboundin interfaceEstablishState- Overrides:
prepareOutboundin classEstablishBase- Throws:
IllegalStateException- always; the state is already corrupt
toString
String representation of the failed state.- Overrides:
toStringin classEstablishBase