mirror of
https://github.com/i2p/i2p.i2p.git
synced 2024-12-06 19:27:00 +01:00
SSU2: Post-termination handler part 4 WIP
Save destroy reason in PeerState2 Add PeerState2 methods to get data for new handler Log when token received
This commit is contained in:
@@ -359,6 +359,7 @@ class PacketBuilder2 {
|
||||
public UDPPacket buildSessionDestroyPacket(int reason, SSU2Sender peer) {
|
||||
if (_log.shouldDebug())
|
||||
_log.debug("Sending termination " + reason + " to : " + peer);
|
||||
peer.setDestroyReason(reason);
|
||||
List<Block> blocks = new ArrayList<Block>(2);
|
||||
if (peer.isIPv6() || !_transport.isSnatted()) {
|
||||
// update token
|
||||
|
||||
@@ -67,6 +67,7 @@ public class PeerState2 extends PeerState implements SSU2Payload.PayloadCallback
|
||||
private long _sentMessagesLastExpired;
|
||||
private byte[] _ourIP;
|
||||
private int _ourPort;
|
||||
private int _destroyReason;
|
||||
|
||||
// Session Confirmed retransmit
|
||||
private byte[][] _sessConfForReTX;
|
||||
@@ -328,7 +329,7 @@ public class PeerState2 extends PeerState implements SSU2Payload.PayloadCallback
|
||||
/**
|
||||
* @since 0.9.57
|
||||
*/
|
||||
public void setDestroyReason(int reason) { /* todo */ }
|
||||
public void setDestroyReason(int reason) { _destroyReason = reason; }
|
||||
|
||||
/// end SSU2Sender interface ///
|
||||
|
||||
@@ -336,6 +337,18 @@ public class PeerState2 extends PeerState implements SSU2Payload.PayloadCallback
|
||||
byte[] getRcvHeaderEncryptKey1() { return _rcvHeaderEncryptKey1; }
|
||||
byte[] getRcvHeaderEncryptKey2() { return _rcvHeaderEncryptKey2; }
|
||||
|
||||
/**
|
||||
* @return 0 (REASON_UNSPEC) if unset
|
||||
* @since 0.9.57 for PeerStateDestroyed
|
||||
*/
|
||||
int getDestroyReason() { return _destroyReason; }
|
||||
|
||||
/**
|
||||
* @since 0.9.57 for PeerStateDestroyed
|
||||
*/
|
||||
CipherState getRcvCipher() { return _rcvCha; }
|
||||
|
||||
|
||||
void setOurAddress(byte[] ip, int port) {
|
||||
_ourIP = ip; _ourPort = port;
|
||||
}
|
||||
@@ -663,6 +676,8 @@ public class PeerState2 extends PeerState implements SSU2Payload.PayloadCallback
|
||||
}
|
||||
|
||||
public void gotToken(long token, long expires) {
|
||||
if (_log.shouldInfo())
|
||||
_log.info("Got TOKEN block: " + token + " expires " + DataHelper.formatTime(expires) + " on " + this);
|
||||
_transport.getEstablisher().addOutboundToken(_remoteHostId, token, expires);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user