forked from I2P_Developers/i2p.i2p
minor transport cleanup
This commit is contained in:
@@ -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 {
|
|||||||
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 {
|
|||||||
* 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 {
|
|||||||
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 {
|
|||||||
|
|
||||||
// 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;
|
|||||||
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 {
|
|||||||
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 ||
|
||||||
|
Reference in New Issue
Block a user