java.lang.Object
net.i2p.util.SimpleTimer2.TimedEvent
net.i2p.router.transport.ntcp.NTCPConnection.NTCP2FailState
- All Implemented Interfaces:
Runnable, NTCPConnection.ReadState
- Enclosing class:
NTCPConnection
private class NTCPConnection.NTCP2FailStateextends SimpleTimer2.TimedEvent implements NTCPConnection.ReadState
After an AEAD failure, read a random number of bytes, with a brief timeout, and then fail.
Call all methods from synchronized parent method.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intBytes read so far in this phase.private final intBytes still to read in this handshake phase.private final intValid frames received before this phase.Fields inherited from class SimpleTimer2.TimedEvent
_state, DEFAULT_FUZZModifier and TypeFieldDescriptionprotected SimpleTimer2.TimedEventStateState of the current event.protected static final intDefault fuzz threshold in milliseconds.Constructor Summary
ConstructorsConstructorDescriptionNTCP2FailState(int toRead, int validFramesRcvd) Read state for the NTCP2 failure message.Method Summary
All MethodsModifier and TypeMethodDescriptionvoiddestroy()Releases the buffers this state holds.intGives the valid frames read so far.voidreceive(ByteBuffer buf) Feeds freshly read data to this state.voidCalled when this event's scheduled time arrives.Methods inherited from class SimpleTimer2.TimedEvent
cancel, forceReschedule, reschedule, reschedule, run, schedule, setFuzz, setPool, toStringModifier and TypeMethodDescriptionbooleancancel()Cancel the timed event.voidforceReschedule(long timeoutMs) Always use the new time - ignores fuzz.voidreschedule(long timeoutMs) Use the earliest of the new time and the old time May be called from within timeReached(), but schedule() is better there.voidreschedule(long timeoutMs, boolean useEarliestTime) May be called from within timeReached(), but schedule() is better there.voidrun()voidschedule(long timeoutMs) Schedule this event.voidsetFuzz(int fuzz) Reschedule threshold in ms.voidsetPool(SimpleTimer2 pool) Timer pool for this event.toString()Timer summary for log messages.
Field Details
_toRead
private final int _toReadBytes still to read in this handshake phase._validFramesRcvd
private final int _validFramesRcvdValid frames received before this phase._read
private int _readBytes read so far in this phase.
Constructor Details
NTCP2FailState
public NTCP2FailState(int toRead, int validFramesRcvd) Read state for the NTCP2 failure message.- Parameters:
toRead- how much left to readvalidFramesRcvd- to be sent in termination message
Method Details
receive
Description copied from interface:NTCPConnection.ReadStateFeeds freshly read data to this state.- Specified by:
receivein interfaceNTCPConnection.ReadState- Parameters:
buf- the data read
destroy
public void destroy()Description copied from interface:NTCPConnection.ReadStateReleases the buffers this state holds.- Specified by:
destroyin interfaceNTCPConnection.ReadState
timeReached
public void timeReached()Description copied from class:SimpleTimer2.TimedEventCalled when this event's scheduled time arrives. Must NOT block. For periodic events, call schedule(period) at the end to self-reschedule.- Specified by:
timeReachedin classSimpleTimer2.TimedEvent
getFramesReceived
public int getFramesReceived()Description copied from interface:NTCPConnection.ReadStateGives the valid frames read so far.- Specified by:
getFramesReceivedin interfaceNTCPConnection.ReadState- Returns:
- the frame count