I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 49e1e1c8 authored by zzz's avatar zzz
Browse files

minor transport cleanup

parent 9b73fcda
No related branches found
No related tags found
No related merge requests found
...@@ -849,8 +849,8 @@ class EstablishState { ...@@ -849,8 +849,8 @@ class EstablishState {
_log.debug(prefix()+"Clock skew: " + diff + " ms"); _log.debug(prefix()+"Clock skew: " + diff + " ms");
} }
sendInboundConfirm(_aliceIdent, tsA);
_con.setRemotePeer(_aliceIdent); _con.setRemotePeer(_aliceIdent);
sendInboundConfirm(_aliceIdent, tsA);
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldLog(Log.DEBUG))
_log.debug(prefix()+"e_bobSig is " + _e_bobSig.length + " bytes long"); _log.debug(prefix()+"e_bobSig is " + _e_bobSig.length + " bytes long");
byte iv[] = _curEncrypted; // reuse buf byte iv[] = _curEncrypted; // reuse buf
......
...@@ -141,8 +141,9 @@ class IntroductionManager { ...@@ -141,8 +141,9 @@ class IntroductionManager {
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldLog(Log.DEBUG))
_log.debug("removing peer " + peer.getRemoteHostId() + ", weRelayToThemAs " _log.debug("removing peer " + peer.getRemoteHostId() + ", weRelayToThemAs "
+ peer.getWeRelayToThemAs() + ", theyRelayToUsAs " + peer.getTheyRelayToUsAs()); + peer.getWeRelayToThemAs() + ", theyRelayToUsAs " + peer.getTheyRelayToUsAs());
if (peer.getWeRelayToThemAs() > 0) long id = peer.getWeRelayToThemAs();
_outbound.remove(Long.valueOf(peer.getWeRelayToThemAs())); if (id > 0)
_outbound.remove(Long.valueOf(id));
if (peer.getTheyRelayToUsAs() > 0) { if (peer.getTheyRelayToUsAs() > 0) {
_inbound.remove(peer); _inbound.remove(peer);
} }
...@@ -306,6 +307,9 @@ class IntroductionManager { ...@@ -306,6 +307,9 @@ class IntroductionManager {
* Send a HolePunch to Alice, who will soon be sending us a RelayRequest. * Send a HolePunch to Alice, who will soon be sending us a RelayRequest.
* We should already have a session with Bob, but probably not with Alice. * We should already have a session with Bob, but probably not with Alice.
* *
* If we don't have a session with Bob, we removed the relay tag from
* our _outbound table, so this won't work.
*
* We do some throttling here. * We do some throttling here.
*/ */
void receiveRelayIntro(RemoteHostId bob, UDPPacketReader reader) { void receiveRelayIntro(RemoteHostId bob, UDPPacketReader reader) {
...@@ -432,7 +436,7 @@ class IntroductionManager { ...@@ -432,7 +436,7 @@ class IntroductionManager {
if (_log.shouldLog(Log.INFO)) if (_log.shouldLog(Log.INFO))
_log.info("Receive relay request from " + alice _log.info("Receive relay request from " + alice
+ " with unknown tag"); + " with unknown tag");
_context.statManager().addRateData("udp.receiveRelayRequestBadTag", 1, 0); _context.statManager().addRateData("udp.receiveRelayRequestBadTag", 1);
return; return;
} }
if (_log.shouldLog(Log.INFO)) if (_log.shouldLog(Log.INFO))
...@@ -442,7 +446,7 @@ class IntroductionManager { ...@@ -442,7 +446,7 @@ class IntroductionManager {
// TODO throttle based on alice identity and/or intro tag? // TODO throttle based on alice identity and/or intro tag?
_context.statManager().addRateData("udp.receiveRelayRequest", 1, 0); _context.statManager().addRateData("udp.receiveRelayRequest", 1);
// send that peer an introduction for alice // send that peer an introduction for alice
_transport.send(_builder.buildRelayIntro(alice, charlie, reader.getRelayRequestReader())); _transport.send(_builder.buildRelayIntro(alice, charlie, reader.getRelayRequestReader()));
......
...@@ -16,6 +16,7 @@ import net.i2p.data.Hash; ...@@ -16,6 +16,7 @@ import net.i2p.data.Hash;
import net.i2p.data.router.RouterIdentity; import net.i2p.data.router.RouterIdentity;
import net.i2p.data.SessionKey; import net.i2p.data.SessionKey;
import net.i2p.data.Signature; import net.i2p.data.Signature;
import net.i2p.router.transport.TransportUtil;
import net.i2p.util.Addresses; import net.i2p.util.Addresses;
import net.i2p.util.Log; import net.i2p.util.Log;
import net.i2p.util.SimpleByteCache; import net.i2p.util.SimpleByteCache;
...@@ -1222,7 +1223,7 @@ class PacketBuilder { ...@@ -1222,7 +1223,7 @@ class PacketBuilder {
byte ikey[] = addr.getIntroducerKey(i); byte ikey[] = addr.getIntroducerKey(i);
long tag = addr.getIntroducerTag(i); long tag = addr.getIntroducerTag(i);
// let's not use an introducer on a privileged port, sounds like trouble // let's not use an introducer on a privileged port, sounds like trouble
if (ikey == null || iport < 1024 || iport > 65535 || if (ikey == null || !TransportUtil.isValidPort(iport) ||
iaddr == null || tag <= 0 || iaddr == null || tag <= 0 ||
// must be IPv4 for now as we don't send Alice IP/port, see below // must be IPv4 for now as we don't send Alice IP/port, see below
iaddr.getAddress().length != 4 || iaddr.getAddress().length != 4 ||
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment