From fcae43547bbdcbb14642d9f4f82f24efdc8c9764 Mon Sep 17 00:00:00 2001 From: idk Date: Sat, 27 Aug 2022 19:26:03 -0400 Subject: [PATCH] explicitly set types of some objects so that the code can be compiled with a Java 7 bootclasspth --- .../transport/udp/IntroductionManager.java | 2 +- .../router/transport/udp/PacketBuilder2.java | 18 +++++++++--------- .../i2p/router/transport/udp/PeerState2.java | 6 ++++-- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/router/java/src/net/i2p/router/transport/udp/IntroductionManager.java b/router/java/src/net/i2p/router/transport/udp/IntroductionManager.java index be5fd990d..383da19ff 100644 --- a/router/java/src/net/i2p/router/transport/udp/IntroductionManager.java +++ b/router/java/src/net/i2p/router/transport/udp/IntroductionManager.java @@ -90,7 +90,7 @@ class IntroductionManager { /** map of relay tag to PeerState who have given us introduction tags */ private final Map _inbound; /** map of relay nonce to alice PeerState who requested it */ - private final Map _nonceToAlice; + private final ConcurrentHashMap _nonceToAlice; private final Set _recentHolePunches; private long _lastHolePunchClean; diff --git a/router/java/src/net/i2p/router/transport/udp/PacketBuilder2.java b/router/java/src/net/i2p/router/transport/udp/PacketBuilder2.java index 68ccf5b41..c0f7aa051 100644 --- a/router/java/src/net/i2p/router/transport/udp/PacketBuilder2.java +++ b/router/java/src/net/i2p/router/transport/udp/PacketBuilder2.java @@ -343,7 +343,7 @@ class PacketBuilder2 { * */ public UDPPacket buildACK(PeerState2 peer) { - return buildPacket(Collections.emptyList(), peer); + return buildPacket(Collections.emptyList(), peer); } /** @@ -363,7 +363,7 @@ class PacketBuilder2 { } Block block = new SSU2Payload.TerminationBlock(reason, peer.getReceivedMessages().getHighestSet()); blocks.add(block); - UDPPacket packet = buildPacket(Collections.emptyList(), blocks, peer); + UDPPacket packet = buildPacket(Collections.emptyList(), blocks, peer); packet.setMessageType(TYPE_DESTROY); return packet; } @@ -652,7 +652,7 @@ class PacketBuilder2 { */ public UDPPacket buildPeerTestFromAlice(byte[] signedData, PeerState2 bob) { Block block = new SSU2Payload.PeerTestBlock(1, 0, null, signedData); - UDPPacket rv = buildPacket(Collections.emptyList(), Collections.singletonList(block), bob); + UDPPacket rv = buildPacket(Collections.emptyList(), Collections.singletonList(block), bob); rv.setMessageType(TYPE_TFA); return rv; } @@ -688,7 +688,7 @@ class PacketBuilder2 { */ public UDPPacket buildPeerTestToAlice(int code, Hash charlieHash, byte[] signedData, PeerState2 alice) { Block block = new SSU2Payload.PeerTestBlock(4, code, charlieHash, signedData); - UDPPacket rv = buildPacket(Collections.emptyList(), Collections.singletonList(block), alice); + UDPPacket rv = buildPacket(Collections.emptyList(), Collections.singletonList(block), alice); rv.setMessageType(TYPE_TTA); return rv; } @@ -724,7 +724,7 @@ class PacketBuilder2 { */ public UDPPacket buildPeerTestToCharlie(Hash aliceHash, byte[] signedData, PeerState2 charlie) { Block block = new SSU2Payload.PeerTestBlock(2, 0, aliceHash, signedData); - UDPPacket rv = buildPacket(Collections.emptyList(), Collections.singletonList(block), charlie); + UDPPacket rv = buildPacket(Collections.emptyList(), Collections.singletonList(block), charlie); rv.setMessageType(TYPE_TBC); return rv; } @@ -737,7 +737,7 @@ class PacketBuilder2 { */ public UDPPacket buildPeerTestToBob(int code, byte[] signedData, PeerState2 bob) { Block block = new SSU2Payload.PeerTestBlock(3, code, null, signedData); - UDPPacket rv = buildPacket(Collections.emptyList(), Collections.singletonList(block), bob); + UDPPacket rv = buildPacket(Collections.emptyList(), Collections.singletonList(block), bob); rv.setMessageType(TYPE_TCB); return rv; } @@ -751,7 +751,7 @@ class PacketBuilder2 { */ UDPPacket buildRelayRequest(byte[] signedData, PeerState2 bob) { Block block = new SSU2Payload.RelayRequestBlock(signedData); - UDPPacket rv = buildPacket(Collections.emptyList(), Collections.singletonList(block), bob); + UDPPacket rv = buildPacket(Collections.emptyList(), Collections.singletonList(block), bob); rv.setMessageType(TYPE_RREQ); rv.setPriority(PRIORITY_HIGH); return rv; @@ -766,7 +766,7 @@ class PacketBuilder2 { */ UDPPacket buildRelayIntro(byte[] signedData, PeerState2 charlie) { Block block = new SSU2Payload.RelayIntroBlock(signedData); - UDPPacket rv = buildPacket(Collections.emptyList(), Collections.singletonList(block), charlie); + UDPPacket rv = buildPacket(Collections.emptyList(), Collections.singletonList(block), charlie); rv.setMessageType(TYPE_INTRO); return rv; } @@ -781,7 +781,7 @@ class PacketBuilder2 { */ UDPPacket buildRelayResponse(byte[] signedData, PeerState2 state) { Block block = new SSU2Payload.RelayResponseBlock(signedData); - UDPPacket rv = buildPacket(Collections.emptyList(), Collections.singletonList(block), state); + UDPPacket rv = buildPacket(Collections.emptyList(), Collections.singletonList(block), state); rv.setMessageType(TYPE_RESP); return rv; } diff --git a/router/java/src/net/i2p/router/transport/udp/PeerState2.java b/router/java/src/net/i2p/router/transport/udp/PeerState2.java index 1646d8ca0..d307c7c0f 100644 --- a/router/java/src/net/i2p/router/transport/udp/PeerState2.java +++ b/router/java/src/net/i2p/router/transport/udp/PeerState2.java @@ -25,6 +25,8 @@ import net.i2p.data.i2np.I2NPMessageImpl; import net.i2p.router.RouterContext; import net.i2p.router.networkdb.kademlia.FloodfillNetworkDatabaseFacade; import net.i2p.router.transport.udp.InboundMessageFragments.ModifiableLong; +import net.i2p.router.transport.udp.PacketBuilder.Fragment; + import static net.i2p.router.transport.udp.SSU2Util.*; import net.i2p.util.HexDump; import net.i2p.util.Log; @@ -457,7 +459,7 @@ public class PeerState2 extends PeerState implements SSU2Payload.PayloadCallback } if (tag > 0) { SSU2Payload.Block block = new SSU2Payload.RelayTagBlock(tag); - UDPPacket pkt = _transport.getBuilder2().buildPacket(Collections.emptyList(), + UDPPacket pkt = _transport.getBuilder2().buildPacket(Collections.emptyList(), Collections.singletonList(block), this); _transport.send(pkt); @@ -649,7 +651,7 @@ public class PeerState2 extends PeerState implements SSU2Payload.PayloadCallback if (_log.shouldInfo()) _log.info("Got PATH CHALLENGE block, length: " + data.length + " on " + this); SSU2Payload.Block block = new SSU2Payload.PathResponseBlock(data); - UDPPacket pkt = _transport.getBuilder2().buildPacket(Collections.emptyList(), + UDPPacket pkt = _transport.getBuilder2().buildPacket(Collections.emptyList(), Collections.singletonList(block), this); // TODO send to from address?