net.i2p.router.transport.udp

## Class PeerState

- java.lang.Object
- - net.i2p.router.transport.udp.PeerState

- Direct Known Subclasses:
    PeerState2

      public class PeerState
      extends Object

  Contain all of the state about a UDP connection to a peer. This is instantiated only after a connection is fully established. Public only for UI peers page. Not a public API, not for external use.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected RouterContext` | `_context`
    `protected boolean` | `_dead` have we migrated away from this peer to another newer one?
    `protected ConcurrentMap<Long,InboundMessageState>` | `_inboundMessages` list of InboundMessageState for active message
    `protected boolean` | `_isInbound` is it inbound?
    `protected long` | `_keyEstablishedTime`
    `protected long` | `_lastACKSend` when did we last send ACKs to the peer?
    `protected Log` | `_log`
    `protected int` | `_mtu` what is the largest packet we can currently send to the peer?
    `protected int` | `_packetsReceivedDuplicate` how many dup packets were received within the last RETRANSMISSION_PERIOD_WIDTH packets
    `protected RemoteHostId` | `_remoteHostId` cached RemoteHostId, used to find the peerState by remote info
    `protected byte[]` | `_remoteIP` what IP is the peer sending and receiving packets on?
    `protected InetAddress` | `_remoteIPAddress` cached IP address
    `protected Hash` | `_remotePeer` The peer are we talking to.
    `protected int` | `_remotePort` what port is the peer sending and receiving packets on?
    `protected int` | `_rtt` current round trip time estimate
    `protected UDPTransport` | `_transport`
    `protected long` | `_wantACKSendSince` when did we decide we need to ACK to this peer?
    `protected static int` | `ACK_FREQUENCY` How frequently do we want to send ACKs to a peer?
    `protected static int` | `CLOCK_SKEW_FUDGE`
    `static int` | `LARGE_MTU` IPv4 Max MTU based on measurements, 1350 fits nearly all reasonably small I2NP messages (larger I2NP messages may be up to 1900B-4500B, which isn't going to fit into a live network MTU anyway) TODO VTBM is 2646, it would be nice to fit in two large 2646 / 2 = 1323 1323 + 74 + 46 + 1 + (4 * 9) = 1480 So why not make it 1492 (old ethernet is 1492, new is 1500) Changed to 1492 in 0.8.9 BUT through 0.8.11, Size estimate was bad, actual packet was up to 48 bytes bigger To be figured out.
    `static int` | `MAX_IPV6_MTU`
    `static int` | `MAX_MTU` Max of IPv4 and IPv6 max MTUs
    `static int` | `MIN_IPV6_MTU` IPv6/UDP header is 48 bytes, so we want MTU % 16 == 0.
    `static int` | `MIN_MTU` IPv4 Min MTU 596 gives us 588 IP byes, 568 UDP bytes, and with an SSU data message, 522 fragment bytes, which is enough to send a tunnel data message in 2 packets.
    `(package private) static long` | `RETRANSMISSION_PERIOD_WIDTH` how many packets will be considered within the retransmission rate calculation

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `PeerState(RouterContext ctx, UDPTransport transport, InetSocketAddress addr, Hash remotePeer, boolean isInbound, int rtt)` For SSU2

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected boolean` | `acked(PacketBuilder.Fragment f)` An ACK of a fragment was received.
    `(package private) void` | `add(OutboundMessageState state)`
    `(package private) void` | `adjustClockSkew(long skew)` Update the moving-average clock skew based on the current difference.
    `(package private) List<OutboundMessageState>` | `allocateSend(long now)` Pick one or more messages we want to send and allocate them out of our window Adjusts the retransmit timer if necessary.
    `(package private) void` | `changePort(int newPort)` Caller should sync; UDPTransport must remove and add to peersByRemoteHost map
    `(package private) void` | `clearWantedACKSendSince()` All acks have been sent - SSU 1 only, see override
    `(package private) void` | `dataReceived()` Same as setLastReceivedTime(now)
    `(package private) void` | `dropOutbound()` drop all outbound messages
    `(package private) void` | `ECNReceived()` We received a backoff request, so cut our send window.
    `(package private) int` | `expireInboundMessages()` Expire partially received inbound messages, returning how many are still pending.
    `(package private) int` | `finishMessages(long now)` Processes outbound messages by expiring overdue messages and completing messages marked as done, updating stats and triggering callbacks.
    `(package private) int` | `fragmentOverhead()` Packet overhead plus room for acks
    `(package private) int` | `fragmentSize()` how much payload data can we shove in there?
    `long` | `getClockSkew()` How far off is the remote peer from our clock, in milliseconds? A positive number means our clock is ahead of theirs.
    `int` | `getConcurrentSends()` 2nd stat in CWND column, otherwise unused - candidate for removal
    `int` | `getConcurrentSendWindow()` 3rd stat in CWND column, otherwise unused, candidate for removal
    `int` | `getConsecutiveFailedSends()` how many seconds have we sent packets without any ACKs received?
    `int` | `getConsecutiveSendRejections()` 4th stat in CWND column, otherwise unused - candidate for removal
    `long` | `getInactivityTime()`
    `(package private) Map<Long,InboundMessageState>` | `getInboundMessages()` Fetch the internal id (Long) to InboundMessageState for incomplete inbound messages.
    `(package private) long` | `getIntroducerTime()` the last time we used them as an introducer, or 0
    `long` | `getKeyEstablishedTime()` When were the current cipher and MAC keys established/rekeyed? This is the connection uptime.
    `long` | `getLastACKSend()` When did we last send an ACK to the peer?
    `long` | `getLastReceiveTime()` When did we last receive a packet from them? Set for data, relay, and peer test, but not acks, pings, or termination
    `long` | `getLastSendFullyTime()` when did we last send them a message that was ACKed?
    `(package private) long` | `getLastSendOrPingTime()` Latest of last sent, last ACK, last ping
    `long` | `getLastSendTime()` When did we last send them a packet? Set for data, relay, and peer test, but not acks, pings, or termination
    `boolean` | `getMayDisconnect()`
    `int` | `getMessagesReceived()` I2NP messages received.
    `int` | `getMessagesSent()` I2NP messages sent - does not include duplicates.
    `int` | `getMTU()` what is the largest packet we can send to the peer?
    `(package private) int` | `getNextDelay(long now)` High usage - OutboundMessageFragments.getNextVolley() calls this 3rd, if allocateSend() returned null.
    `int` | `getOutboundMessageCount()`
    `int` | `getPacketsReceived()`
    `int` | `getPacketsReceivedDuplicate()`
    `int` | `getPacketsRetransmitted()`
    `int` | `getPacketsTransmitted()`
    `int` | `getReceiveBps(long now)` An approximation, for display only
    `int` | `getReceiveMTU()` Estimate how large the other side's MTU is.
    `RemoteHostId` | `getRemoteHostId()`
    `byte[]` | `getRemoteIP()` what IP is the peer sending and receiving packets on?
    `InetAddress` | `getRemoteIPAddress()`
    `Hash` | `getRemotePeer()` The peer are we talking to.
    `int` | `getRemotePort()` what port is the peer sending and receiving packets on?
    `int` | `getRTO()` How soon should we retransmit an unacked packet?
    `int` | `getRTT()` How long does it usually take to get a message ACKed?
    `int` | `getRTTDeviation()` How skewed are the measured RTTs?
    `int` | `getSendBps(long now)` The Westwood+ bandwidth estimate
    `int` | `getSendWindowBytes()` how many bytes should we send to the peer in a second 1st stat in CWND column, otherwise unused, candidate for removal
    `int` | `getSendWindowBytesRemaining()` how many bytes can we send to the peer in the current second
    `int` | `getSlowStartThreshold()` Stat in SST column, otherwise unused - candidate for removal
    `long` | `getTheyRelayToUsAs()` If they have offered to serve as an introducer to us, this is the tag we can use to publish that fact.
    `(package private) UDPTransport` | `getTransport()` Convenience for OutboundMessageState so it can fail itself
    `int` | `getVersion()`
    `long` | `getWeRelayToThemAs()` if we are serving as an introducer to them, this is the the tag that they can publish that, when presented to us, will cause us to send a relay introduction to the current peer
    `(package private) boolean` | `highestSeqNumAcked(long highest)` Enter or leave fast retransmit mode, and adjust SST and window variables accordingly.
    `(package private) int` | `incrementConsecutiveFailedSends()`
    `boolean` | `isBacklogged()`
    `boolean` | `isInbound()`
    `boolean` | `isIPv6()`
    `(package private) void` | `loadFrom(PeerState oldPeer)` Transfer the basic activity/state from the old peer to the current peer SSU 1 or 2.
    `(package private) void` | `messageFullyReceived(Long messageId, int bytes)` We received the message specified completely.
    `(package private) void` | `messagePartiallyReceived()` We received a partial message, or we want to send some acks.
    `protected void` | `messagePartiallyReceived(long now)` We received a partial message, or we want to send some acks.
    `(package private) void` | `messageRetransmitted(int packets, int maxPktSz)` we are resending a packet, so let's jack up the rto
    `(package private) void` | `packetReceived(int size)`
    `(package private) void` | `packetsTransmitted(int packets)`
    `(package private) void` | `setHisMTU(int mtu)`
    `(package private) void` | `setIntroducerTime()` set the last time we used them as an introducer to now
    `(package private) void` | `setLastPingTime(long when)` Note ping sent.
    `(package private) void` | `setLastReceiveTime(long when)` When did we last receive a packet from them? Set for data, relay, and peer test, but not acks, pings, or termination
    `(package private) void` | `setLastSendTime(long when)` When did we last send them a packet? Set for data, relay, and peer test, but not acks, pings, or termination
    `void` | `setMayDisconnect()` Sets to true.
    `(package private) void` | `setTheyRelayToUsAs(long tag)` If they have offered to serve as an introducer to us, this is the tag we can use to publish that fact.
    `(package private) void` | `setWeRelayToThemAs(long tag)` If we are serving as an introducer to them, this is the the tag that they can publish that, when presented to us, will cause us to send a relay introduction to the current peer
    `protected boolean` | `shouldRequestImmediateAck()` SSU 2 only
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### _context

          protected final RouterContext _context

    - #### _dead

          protected volatile boolean _dead

      have we migrated away from this peer to another newer one?

    - #### _inboundMessages

          protected final ConcurrentMap<Long,InboundMessageState> _inboundMessages

      list of InboundMessageState for active message

    - #### _isInbound

          protected final boolean _isInbound

      is it inbound?

    - #### _keyEstablishedTime

          protected final long _keyEstablishedTime

    - #### _lastACKSend

          protected volatile long _lastACKSend

      when did we last send ACKs to the peer?

    - #### _log

          protected final Log _log

    - #### _mtu

          protected int _mtu

      what is the largest packet we can currently send to the peer?

    - #### _packetsReceivedDuplicate

          protected int _packetsReceivedDuplicate

      how many dup packets were received within the last RETRANSMISSION_PERIOD_WIDTH packets

    - #### _remoteHostId

          protected volatile RemoteHostId _remoteHostId

      cached RemoteHostId, used to find the peerState by remote info

    - #### _remoteIP

          protected final byte[] _remoteIP

      what IP is the peer sending and receiving packets on?

    - #### _remoteIPAddress

          protected volatile InetAddress _remoteIPAddress

      cached IP address

    - #### _remotePeer

          protected final Hash _remotePeer

      The peer are we talking to. This should be set as soon as this state is created if we are initiating a connection, but if we are receiving the connection this will be set only after the connection is established.

    - #### _remotePort

          protected volatile int _remotePort

      what port is the peer sending and receiving packets on?

    - #### _rtt

          protected volatile int _rtt

      current round trip time estimate

    - #### _transport

          protected final UDPTransport _transport

    - #### _wantACKSendSince

          protected volatile long _wantACKSendSince

      when did we decide we need to ACK to this peer?

    - #### ACK_FREQUENCY

          protected static final int ACK_FREQUENCY

      How frequently do we want to send ACKs to a peer?
      See Also:
        Constant Field Values

    - #### CLOCK_SKEW_FUDGE

          protected static final int CLOCK_SKEW_FUDGE

      See Also:
        Constant Field Values

    - #### LARGE_MTU

          public static final int LARGE_MTU

      IPv4 Max MTU based on measurements, 1350 fits nearly all reasonably small I2NP messages (larger I2NP messages may be up to 1900B-4500B, which isn't going to fit into a live network MTU anyway) TODO VTBM is 2646, it would be nice to fit in two large 2646 / 2 = 1323 1323 + 74 + 46 + 1 + (4 * 9) = 1480 So why not make it 1492 (old ethernet is 1492, new is 1500) Changed to 1492 in 0.8.9 BUT through 0.8.11, Size estimate was bad, actual packet was up to 48 bytes bigger To be figured out. Curse the ACKs. Assuming that we can enforce an MTU correctly, this % 16 should be 12, as the IP/UDP header is 28 bytes and data max should be mulitple of 16 for padding efficiency, and so PacketBuilder.buildPacket() works correctly.
      See Also:
        Constant Field Values

    - #### MAX_IPV6_MTU

          public static final int MAX_IPV6_MTU

      See Also:
        Constant Field Values

    - #### MAX_MTU

          public static final int MAX_MTU

      Max of IPv4 and IPv6 max MTUs

    - #### MIN_IPV6_MTU

          public static final int MIN_IPV6_MTU

      IPv6/UDP header is 48 bytes, so we want MTU % 16 == 0.
      See Also:
        Constant Field Values

    - #### MIN_MTU

          public static final int MIN_MTU

      IPv4 Min MTU 596 gives us 588 IP byes, 568 UDP bytes, and with an SSU data message, 522 fragment bytes, which is enough to send a tunnel data message in 2 packets. A tunnel data message sent over the wire is 1044 bytes, meaning we need 522 fragment bytes to fit it in 2 packets - add 46 for SSU, 20 for UDP, and 8 for IP, giving us 596. round up to mod 16, giving a total of 608 Well, we really need to count the acks as well, especially 1 + (4 * MAX_RESEND_ACKS_SMALL) which can take up a significant amount of space. We reduce the max acks when using the small MTU but it may not be enough... Goal: VTBM msg fragments 2646 / (620 - 87) fits nicely. Assuming that we can enforce an MTU correctly, this % 16 should be 12, as the IP/UDP header is 28 bytes and data max should be mulitple of 16 for padding efficiency, and so PacketBuilder.buildPacket() works correctly.
      See Also:
        Constant Field Values

    - #### RETRANSMISSION_PERIOD_WIDTH

          static final long RETRANSMISSION_PERIOD_WIDTH

      how many packets will be considered within the retransmission rate calculation

  - ### Constructor Detail

    - #### PeerState

          protected PeerState(RouterContext ctx,
                              UDPTransport transport,
                              InetSocketAddress addr,
                              Hash remotePeer,
                              boolean isInbound,
                              int rtt)

      For SSU2

  - ### Method Detail

    - #### acked

          protected boolean acked(PacketBuilder.Fragment f)

      An ACK of a fragment was received. SSU 2 only.
      Returns:
        true if this fragment of the message was acked for the first time

    - #### add

          void add(OutboundMessageState state)

    - #### adjustClockSkew

          void adjustClockSkew(long skew)

      Update the moving-average clock skew based on the current difference. The raw skew will be adjusted for RTT/2 here. A positive number means our clock is ahead of theirs.
      Parameters:
        `skew` - milliseconds, NOT adjusted for RTT.

    - #### allocateSend

          List<OutboundMessageState> allocateSend(long now)

      Pick one or more messages we want to send and allocate them out of our window Adjusts the retransmit timer if necessary. High usage - OutboundMessageFragments.getNextVolley() calls this 2nd, if finishMessages() returned > 0. TODO combine finishMessages() and allocateSend() so we don't iterate 2 times.
      Returns:
        allocated messages to send (never empty), or null if no messages or no resources

    - #### changePort

          void changePort(int newPort)

      Caller should sync; UDPTransport must remove and add to peersByRemoteHost map

    - #### clearWantedACKSendSince

          void clearWantedACKSendSince()

      All acks have been sent - SSU 1 only, see override

    - #### dataReceived

          void dataReceived()

      Same as setLastReceivedTime(now)

    - #### dropOutbound

          void dropOutbound()

      drop all outbound messages

    - #### ECNReceived

          void ECNReceived()

      We received a backoff request, so cut our send window. NOTE: ECN sending is unimplemented, this is never called.

    - #### expireInboundMessages

          int expireInboundMessages()

      Expire partially received inbound messages, returning how many are still pending. This should probably be fired periodically, in case a peer goes silent and we don't try to send them any messages (and don't receive any messages from them either)

    - #### finishMessages

          int finishMessages(long now)

      Processes outbound messages by expiring overdue messages and completing messages marked as done, updating stats and triggering callbacks. Returns the total count of active plus queued messages.
      Parameters:
        `now` - current time in milliseconds for expiration checks
      Returns:
        total count of active outbound messages plus those queued for sending

    - #### fragmentOverhead

          int fragmentOverhead()

      Packet overhead plus room for acks
      Returns:
        87 (IPv4), 107 (IPv6)

    - #### fragmentSize

          int fragmentSize()

      how much payload data can we shove in there?
      Returns:
        MTU - 87, i.e. 533 or 1397 (IPv4), MTU - 107 (IPv6)

    - #### getClockSkew

          public long getClockSkew()

      How far off is the remote peer from our clock, in milliseconds? A positive number means our clock is ahead of theirs.

    - #### getConcurrentSends

          public int getConcurrentSends()

      2nd stat in CWND column, otherwise unused - candidate for removal

    - #### getConcurrentSendWindow

          public int getConcurrentSendWindow()

      3rd stat in CWND column, otherwise unused, candidate for removal

    - #### getConsecutiveFailedSends

          public int getConsecutiveFailedSends()

      how many seconds have we sent packets without any ACKs received?

    - #### getConsecutiveSendRejections

          public int getConsecutiveSendRejections()

      4th stat in CWND column, otherwise unused - candidate for removal

    - #### getInactivityTime

          public long getInactivityTime()

    - #### getInboundMessages

          Map<Long,InboundMessageState> getInboundMessages()

      Fetch the internal id (Long) to InboundMessageState for incomplete inbound messages. Access to this map must be synchronized explicitly!

    - #### getIntroducerTime

          long getIntroducerTime()

      the last time we used them as an introducer, or 0

    - #### getKeyEstablishedTime

          public long getKeyEstablishedTime()

      When were the current cipher and MAC keys established/rekeyed? This is the connection uptime.

    - #### getLastACKSend

          public long getLastACKSend()

      When did we last send an ACK to the peer?

    - #### getLastReceiveTime

          public long getLastReceiveTime()

      When did we last receive a packet from them? Set for data, relay, and peer test, but not acks, pings, or termination

    - #### getLastSendFullyTime

          public long getLastSendFullyTime()

      when did we last send them a message that was ACKed?

    - #### getLastSendOrPingTime

          long getLastSendOrPingTime()

      Latest of last sent, last ACK, last ping

    - #### getLastSendTime

          public long getLastSendTime()

      When did we last send them a packet? Set for data, relay, and peer test, but not acks, pings, or termination

    - #### getMayDisconnect

          public boolean getMayDisconnect()

    - #### getMessagesReceived

          public int getMessagesReceived()

      I2NP messages received. As of 0.9.24, does not include duplicates.

    - #### getMessagesSent

          public int getMessagesSent()

      I2NP messages sent - does not include duplicates. As of 0.9.24, incremented when bandwidth is allocated just before sending, not when acked.

    - #### getMTU

          public int getMTU()

      what is the largest packet we can send to the peer?

    - #### getNextDelay

          int getNextDelay(long now)

      High usage - OutboundMessageFragments.getNextVolley() calls this 3rd, if allocateSend() returned null. TODO combine finishMessages(), allocateSend() so we don't iterate 2 times.
      Parameters:
        `now` - what time it is now
      Returns:
        how long to wait before sending, or Integer.MAX_VALUE if we have nothing to send. If ready now, will return 0.

    - #### getOutboundMessageCount

          public int getOutboundMessageCount()

      Returns:
        number of active outbound messages remaining (unsynchronized)

    - #### getPacketsReceived

          public int getPacketsReceived()

    - #### getPacketsReceivedDuplicate

          public int getPacketsReceivedDuplicate()

    - #### getPacketsRetransmitted

          public int getPacketsRetransmitted()

    - #### getPacketsTransmitted

          public int getPacketsTransmitted()

    - #### getReceiveBps

          public int getReceiveBps(long now)

      An approximation, for display only
      Returns:
        the smoothed receive transfer rate

    - #### getReceiveMTU

          public int getReceiveMTU()

      Estimate how large the other side's MTU is. This could be wrong. It is used only for the HTML status.

    - #### getRemoteHostId

          public RemoteHostId getRemoteHostId()

      Returns:
        non-null

    - #### getRemoteIP

          public byte[] getRemoteIP()

      what IP is the peer sending and receiving packets on?

    - #### getRemoteIPAddress

          public InetAddress getRemoteIPAddress()

      Returns:
        may be null if IP is invalid

    - #### getRemotePeer

          public Hash getRemotePeer()

      The peer are we talking to. Non-null.

    - #### getRemotePort

          public int getRemotePort()

      what port is the peer sending and receiving packets on?

    - #### getRTO

          public int getRTO()

      How soon should we retransmit an unacked packet?

    - #### getRTT

          public int getRTT()

      How long does it usually take to get a message ACKed?

    - #### getRTTDeviation

          public int getRTTDeviation()

      How skewed are the measured RTTs?

    - #### getSendBps

          public int getSendBps(long now)

      The Westwood+ bandwidth estimate
      Returns:
        the smoothed send transfer rate

    - #### getSendWindowBytes

          public int getSendWindowBytes()

      how many bytes should we send to the peer in a second 1st stat in CWND column, otherwise unused, candidate for removal

    - #### getSendWindowBytesRemaining

          public int getSendWindowBytesRemaining()

      how many bytes can we send to the peer in the current second

    - #### getSlowStartThreshold

          public int getSlowStartThreshold()

      Stat in SST column, otherwise unused - candidate for removal

    - #### getTheyRelayToUsAs

          public long getTheyRelayToUsAs()

      If they have offered to serve as an introducer to us, this is the tag we can use to publish that fact.
      Returns:
        0 (no relay) if unset previously

    - #### getTransport

          UDPTransport getTransport()

      Convenience for OutboundMessageState so it can fail itself

    - #### getVersion

          public int getVersion()

    - #### getWeRelayToThemAs

          public long getWeRelayToThemAs()

      if we are serving as an introducer to them, this is the the tag that they can publish that, when presented to us, will cause us to send a relay introduction to the current peer
      Returns:
        0 (no relay) if unset previously

    - #### highestSeqNumAcked

          boolean highestSeqNumAcked(long highest)

      Enter or leave fast retransmit mode, and adjust SST and window variables accordingly. See RFC 5681 sec. 2.4
      Parameters:
        `highest` - the highest sequence number that was acked
      Returns:
        true if we have something to fast-retransmit

    - #### incrementConsecutiveFailedSends

          int incrementConsecutiveFailedSends()

    - #### isBacklogged

          public boolean isBacklogged()

    - #### isInbound

          public boolean isInbound()

    - #### isIPv6

          public boolean isIPv6()

    - #### loadFrom

          void loadFrom(PeerState oldPeer)

      Transfer the basic activity/state from the old peer to the current peer SSU 1 or 2.
      Parameters:
        `oldPeer` - non-null

    - #### messageFullyReceived

          void messageFullyReceived(Long messageId,
                                    int bytes)

      We received the message specified completely.
      Parameters:
        `bytes` - if less than or equal to zero, message is a duplicate.

    - #### messagePartiallyReceived

          void messagePartiallyReceived()

      We received a partial message, or we want to send some acks.

    - #### messagePartiallyReceived

          protected void messagePartiallyReceived(long now)

      We received a partial message, or we want to send some acks.

    - #### messageRetransmitted

          void messageRetransmitted(int packets,
                                    int maxPktSz)

      we are resending a packet, so let's jack up the rto

    - #### packetReceived

          void packetReceived(int size)

      Parameters:
        `size` - not including IP header, UDP header, MAC or IV

    - #### packetsTransmitted

          void packetsTransmitted(int packets)

    - #### setHisMTU

          void setHisMTU(int mtu)

    - #### setIntroducerTime

          void setIntroducerTime()

      set the last time we used them as an introducer to now

    - #### setLastPingTime

          void setLastPingTime(long when)

      Note ping sent. Does not update last send time.

    - #### setLastReceiveTime

          void setLastReceiveTime(long when)

      When did we last receive a packet from them? Set for data, relay, and peer test, but not acks, pings, or termination

    - #### setLastSendTime

          void setLastSendTime(long when)

      When did we last send them a packet? Set for data, relay, and peer test, but not acks, pings, or termination

    - #### setMayDisconnect

          public void setMayDisconnect()

      Sets to true.

    - #### setTheyRelayToUsAs

          void setTheyRelayToUsAs(long tag)

      If they have offered to serve as an introducer to us, this is the tag we can use to publish that fact.
      Parameters:
        `tag` - 1 to Integer.MAX_VALUE, or 0 if relaying disabled

    - #### setWeRelayToThemAs

          void setWeRelayToThemAs(long tag)

      If we are serving as an introducer to them, this is the the tag that they can publish that, when presented to us, will cause us to send a relay introduction to the current peer
      Parameters:
        `tag` - 1 to Integer.MAX_VALUE, or 0 if relaying disabled

    - #### shouldRequestImmediateAck

          protected boolean shouldRequestImmediateAck()

      SSU 2 only

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`