class OutboundEstablishState extends Object
| Modifier and Type | Class and Description |
|---|---|
static class | OutboundEstablishState.OutboundStateStates for outbound SSU session establishment. |
| Modifier and Type | Field and Description |
|---|---|
protected byte[] | _aliceIPAlice's IP |
protected int | _alicePortAlice's port |
protected byte[] | _bobIPBob's IP |
protected int | _bobPortBob's port |
protected RouterContext | _contextThe router context |
protected OutboundEstablishState.OutboundState | _currentStateCurrent state |
protected long | _establishBeginEstablish begin time |
protected long | _lastSendLast send time |
protected Log | _logLogger |
protected long | _nextSendNext send time |
protected long | _receivedRelayTagReceived relay tag |
protected RemoteHostId | _remoteHostIdRemote host ID |
protected RouterIdentity | _remotePeerRemote peer |
protected int | _requestSentCountRequest sent count |
protected long | _requestSentTimeRequest sent time |
protected int | _rttRound trip time |
protected static long | MAX_DELAYMax delay including backoff (15 seconds) |
protected static long | RETRANSMIT_DELAYFlat delay between all retransmits (no exponential backoff). |
| Modifier | Constructor and Description |
|---|---|
protected | OutboundEstablishState(RouterContext ctx,
RemoteHostId claimedAddress,
RemoteHostId remoteHostId,
RouterIdentity remotePeer,
boolean needIntroduction,
SessionKey introKey,
UDPAddress addr)For SSU2 |
| Modifier and Type | Method and Description |
|---|---|
void | addMessage(OutNetMessage msg)Queue a message to be sent after the session is established. |
boolean | complete()Mark as complete. |
void | confirmedPacketsSent()note that we just sent the SessionConfirmed packet |
void | dataReceived()we have received a real data packet, so we're done establishing |
void | fail()The SessionCreated validation failed |
(package private) RemoteHostId | getClaimedAddress()This will never be a hash-based address. |
long | getConfirmedSentTime()When we sent the first SessionConfirmed packet. |
long | getEstablishBeginTime() |
SessionKey | getIntroKey()Bob's introduction key, as published in the netdb |
long | getIntroNonce()Get the introduction nonce, or -1 if unset. |
long | getIntroSentTime()When we sent the first RelayRequest packet. |
long | getLifetime()How long have we been trying to establish this session? |
long | getLifetime(long now)How long have we been trying to establish this session? |
OutNetMessage | getNextQueuedMessage()Get the next queued message. |
long | getNextSendTime()The next time a message should be sent. |
byte[] | getReceivedIP() |
int | getReceivedPort() |
long | getReceivedRelayTag() |
long | getReceivedSignedOnTime() |
UDPAddress | getRemoteAddress() |
(package private) RemoteHostId | getRemoteHostId()This should be what the state is currently indexed by in the _outboundStates table. |
RouterIdentity | getRemoteIdentity() |
long | getRequestSentTime()When we sent the first SessionRequest packet. |
(package private) int | getRTT() |
byte[] | getSentIP()The remote side (Bob) - note that in some places he's called Charlie. |
int | getSentPort()The remote side (Bob) - note that in some places he's called Charlie. |
long | getSentSignedOnTime() |
OutboundEstablishState.OutboundState | getState() |
int | getVersion()Get the version of the SSU protocol in use. |
void | introduced(byte[] bobIP,
int bobPort)This changes the remoteHostId from a hash-based one or possibly
incorrect IP/port to what the introducer told us. |
void | introductionFailed()introductionFailed. |
void | introSent()note that we just sent the RelayRequest packet |
boolean | isExtendedOptionsAllowed()Are we allowed to send extended options to this peer? |
boolean | isFirstMessageOurDSM()Is the first message queued our own DatabaseStoreMessage? |
boolean | needIntroduction()Should we ask this peer to be an introducer for us?
Ignored unless allowExtendedOptions is true |
protected void | packetReceived()Call from synchronized method only |
(package private) boolean | receiveHolePunch()Accelerate response to RelayResponse if we haven't sent it yet. |
void | requestSent()note that we just sent the SessionRequest packet |
void | setIntroNonce(long nonce) |
String | toString()Get string representation |
boolean | validateSessionCreated()Blocking call (run in the establisher thread) to determine if the
session was created properly. |
protected byte[] _aliceIP
protected int _alicePort
protected byte[] _bobIP
protected int _bobPort
protected final RouterContext _context
protected OutboundEstablishState.OutboundState _currentState
protected final long _establishBegin
protected long _lastSend
protected final Log _log
protected long _nextSend
protected long _receivedRelayTag
protected RemoteHostId _remoteHostId
protected final RouterIdentity _remotePeer
protected int _requestSentCount
protected long _requestSentTime
protected int _rtt
protected static final long MAX_DELAY
protected static final long RETRANSMIT_DELAY
protected OutboundEstablishState(RouterContext ctx, RemoteHostId claimedAddress, RemoteHostId remoteHostId, RouterIdentity remotePeer, boolean needIntroduction, SessionKey introKey, UDPAddress addr)
ctx - the router contextclaimedAddress - the claimed address from the netdbremoteHostId - the remote host IDremotePeer - the remote peer identityneedIntroduction - whether introduction is neededintroKey - the introduction keyaddr - the UDP addresspublic void addMessage(OutNetMessage msg)
msg - the message to queuepublic boolean complete()
public void confirmedPacketsSent()
public void dataReceived()
public void fail()
RemoteHostId getClaimedAddress()
public long getConfirmedSentTime()
public long getEstablishBeginTime()
public SessionKey getIntroKey()
public long getIntroNonce()
public long getIntroSentTime()
public long getLifetime()
public long getLifetime(long now)
now - the current timepublic OutNetMessage getNextQueuedMessage()
public long getNextSendTime()
public byte[] getReceivedIP()
public int getReceivedPort()
public long getReceivedRelayTag()
public long getReceivedSignedOnTime()
public UDPAddress getRemoteAddress()
RemoteHostId getRemoteHostId()
public RouterIdentity getRemoteIdentity()
public long getRequestSentTime()
int getRTT()
public byte[] getSentIP()
public int getSentPort()
public long getSentSignedOnTime()
public OutboundEstablishState.OutboundState getState()
public int getVersion()
public void introduced(byte[] bobIP,
int bobPort)bobIP - the remote IPbobPort - the remote portpublic void introductionFailed()
public void introSent()
public boolean isExtendedOptionsAllowed()
public boolean isFirstMessageOurDSM()
public boolean needIntroduction()
protected void packetReceived()
boolean receiveHolePunch()
public void requestSent()
public void setIntroNonce(long nonce)
nonce - the introduction noncepublic boolean validateSessionCreated()