Use DG3 for announce requests

allows elimination of conn ID table on tracker
see prop. 160 changes
This commit is contained in:
zzz
2025-04-27 17:07:10 -04:00
parent b6d354260a
commit 1ea136d013

View File

@ -13,6 +13,7 @@ import net.i2p.client.I2PSessionException;
import net.i2p.client.I2PSessionMuxedListener;
import net.i2p.client.SendMessageOptions;
import net.i2p.client.datagram.Datagram2;
import net.i2p.client.datagram.Datagram3;
import net.i2p.client.datagram.I2PInvalidDatagramException;
import net.i2p.data.DataFormatException;
import net.i2p.data.DataHelper;
@ -432,6 +433,14 @@ class UDPTrackerClient implements I2PSessionMuxedListener {
_log.warn("DG2 fail", dfe);
return false;
}
} else {
try {
payload = Datagram3.make(_context, _session, payload);
} catch (DataFormatException dfe) {
if (_log.shouldWarn())
_log.warn("DG3 fail", dfe);
return false;
}
}
SendMessageOptions opts = new SendMessageOptions();
@ -440,7 +449,7 @@ class UDPTrackerClient implements I2PSessionMuxedListener {
opts.setSendLeaseSet(false);
try {
boolean success = _session.sendMessage(dest, payload, 0, payload.length,
repliable ? I2PSession.PROTO_DATAGRAM2 : I2PSession.PROTO_DATAGRAM_RAW,
repliable ? I2PSession.PROTO_DATAGRAM2 : I2PSession.PROTO_DATAGRAM3,
_rPort, toPort, opts);
if (success) {
// ...
@ -570,6 +579,7 @@ class UDPTrackerClient implements I2PSessionMuxedListener {
waiter.gotResponse(resp);
Tracker tr = waiter.getSentTo();
tr.gotError();
// TODO if we were waiting for an announce reply, fire off a new connection request
}
// I2PSessionMuxedListener interface ----------------