Skip to content

Commit

Permalink
explicitly set types of some objects so that the code can be compiled…
Browse files Browse the repository at this point in the history
… with a Java 7 bootclasspth
  • Loading branch information
eyedeekay committed Aug 27, 2022
1 parent 3995403 commit fcae435
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class IntroductionManager {
/** map of relay tag to PeerState who have given us introduction tags */
private final Map<Long, PeerState> _inbound;
/** map of relay nonce to alice PeerState who requested it */
private final Map<Long, PeerState2> _nonceToAlice;
private final ConcurrentHashMap<Long, PeerState2> _nonceToAlice;
private final Set<InetAddress> _recentHolePunches;
private long _lastHolePunchClean;

Expand Down
18 changes: 9 additions & 9 deletions router/java/src/net/i2p/router/transport/udp/PacketBuilder2.java
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ public UDPPacket buildPing(PeerState2 peer) {
*
*/
public UDPPacket buildACK(PeerState2 peer) {
return buildPacket(Collections.emptyList(), peer);
return buildPacket(Collections.<Fragment>emptyList(), peer);
}

/**
Expand All @@ -363,7 +363,7 @@ public UDPPacket buildSessionDestroyPacket(int reason, PeerState2 peer) {
}
Block block = new SSU2Payload.TerminationBlock(reason, peer.getReceivedMessages().getHighestSet());
blocks.add(block);
UDPPacket packet = buildPacket(Collections.emptyList(), blocks, peer);
UDPPacket packet = buildPacket(Collections.<Fragment>emptyList(), blocks, peer);
packet.setMessageType(TYPE_DESTROY);
return packet;
}
Expand Down Expand Up @@ -652,7 +652,7 @@ private UDPPacket[] buildSessionConfirmedPackets(OutboundEstablishState2 state,
*/
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.<Fragment>emptyList(), Collections.singletonList(block), bob);
rv.setMessageType(TYPE_TFA);
return rv;
}
Expand Down Expand Up @@ -688,7 +688,7 @@ public UDPPacket buildPeerTestFromAlice(InetAddress toIP, int toPort, SessionKey
*/
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.<Fragment>emptyList(), Collections.singletonList(block), alice);
rv.setMessageType(TYPE_TTA);
return rv;
}
Expand Down Expand Up @@ -724,7 +724,7 @@ public UDPPacket buildPeerTestToAlice(InetAddress aliceIP, int alicePort, Sessio
*/
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.<Fragment>emptyList(), Collections.singletonList(block), charlie);
rv.setMessageType(TYPE_TBC);
return rv;
}
Expand All @@ -737,7 +737,7 @@ public UDPPacket buildPeerTestToCharlie(Hash aliceHash, byte[] signedData, PeerS
*/
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.<Fragment>emptyList(), Collections.singletonList(block), bob);
rv.setMessageType(TYPE_TCB);
return rv;
}
Expand All @@ -751,7 +751,7 @@ public UDPPacket buildPeerTestToBob(int code, byte[] signedData, PeerState2 bob)
*/
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.<Fragment>emptyList(), Collections.singletonList(block), bob);
rv.setMessageType(TYPE_RREQ);
rv.setPriority(PRIORITY_HIGH);
return rv;
Expand All @@ -766,7 +766,7 @@ UDPPacket buildRelayRequest(byte[] signedData, PeerState2 bob) {
*/
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.<Fragment>emptyList(), Collections.singletonList(block), charlie);
rv.setMessageType(TYPE_INTRO);
return rv;
}
Expand All @@ -781,7 +781,7 @@ UDPPacket buildRelayIntro(byte[] signedData, PeerState2 charlie) {
*/
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.<Fragment>emptyList(), Collections.singletonList(block), state);
rv.setMessageType(TYPE_RESP);
return rv;
}
Expand Down
6 changes: 4 additions & 2 deletions router/java/src/net/i2p/router/transport/udp/PeerState2.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
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;
Expand Down Expand Up @@ -457,7 +459,7 @@ public void gotRelayTagRequest() {
}
if (tag > 0) {
SSU2Payload.Block block = new SSU2Payload.RelayTagBlock(tag);
UDPPacket pkt = _transport.getBuilder2().buildPacket(Collections.emptyList(),
UDPPacket pkt = _transport.getBuilder2().buildPacket(Collections.<Fragment>emptyList(),
Collections.singletonList(block),
this);
_transport.send(pkt);
Expand Down Expand Up @@ -649,7 +651,7 @@ public void gotPathChallenge(RemoteHostId from, byte[] data) {
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.<Fragment>emptyList(),
Collections.singletonList(block),
this);
// TODO send to from address?
Expand Down

0 comments on commit fcae435

Please sign in to comment.