forked from I2P_Developers/i2p.i2p
SSU ext. options:
- don't ask for intro if he is indirect - ask for intro if our state is unknown - debug logging - change min to 0.9.23 for testing
This commit is contained in:
@@ -132,10 +132,11 @@ class EstablishmentManager {
|
||||
* but i2pd hasn't recognized it until this release.
|
||||
* No matter, the options weren't defined until this release anyway.
|
||||
*
|
||||
* FIXME 0.9.22 for testing, change to 0.9.24 for release
|
||||
**********************************************************************************************************
|
||||
* FIXME 0.9.23 for testing, change to 0.9.24 for release
|
||||
*
|
||||
*/
|
||||
private static final String VERSION_ALLOW_EXTENDED_OPTIONS = "0.9.22";
|
||||
private static final String VERSION_ALLOW_EXTENDED_OPTIONS = "0.9.23";
|
||||
private static final String PROP_DISABLE_EXT_OPTS = "i2np.udp.disableExtendedOptions";
|
||||
|
||||
|
||||
@@ -373,7 +374,9 @@ class EstablishmentManager {
|
||||
VERSION_ALLOW_EXTENDED_OPTIONS) >= 0
|
||||
&& !_context.getBooleanProperty(PROP_DISABLE_EXT_OPTS);
|
||||
// w/o ext options, it's always 'requested', no need to set
|
||||
boolean requestIntroduction = allowExtendedOptions && _transport.introducersRequired();
|
||||
// don't ask if they are indirect
|
||||
boolean requestIntroduction = allowExtendedOptions && !isIndirect &&
|
||||
_transport.introducersMaybeRequired();
|
||||
state = new OutboundEstablishState(_context, maybeTo, to,
|
||||
toIdentity, allowExtendedOptions,
|
||||
requestIntroduction,
|
||||
|
@@ -155,6 +155,8 @@ class InboundEstablishState {
|
||||
byte[] ext = req.readExtendedOptions();
|
||||
if (ext != null && ext.length >= UDPPacket.SESS_REQ_MIN_EXT_OPTIONS_LENGTH) {
|
||||
_introductionRequested = (ext[1] & (byte) UDPPacket.SESS_REQ_EXT_FLAG_REQUEST_RELAY_TAG) != 0;
|
||||
if (_log.shouldInfo())
|
||||
_log.info("got sess req. w/ ext. options, need intro? " + _introductionRequested + ' ' + this);
|
||||
}
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Receive sessionRequest, BobIP = " + Addresses.toString(_bobIP));
|
||||
|
@@ -788,8 +788,11 @@ class PacketBuilder {
|
||||
boolean ext = state.isExtendedOptionsAllowed();
|
||||
if (ext) {
|
||||
options = new byte[UDPPacket.SESS_REQ_MIN_EXT_OPTIONS_LENGTH];
|
||||
if (state.needIntroduction())
|
||||
boolean intro = state.needIntroduction();
|
||||
if (intro)
|
||||
options[1] = (byte) UDPPacket.SESS_REQ_EXT_FLAG_REQUEST_RELAY_TAG;
|
||||
if (_log.shouldInfo())
|
||||
_log.info("send sess req. w/ ext. options, need intro? " + intro + ' ' + state);
|
||||
off += UDPPacket.SESS_REQ_MIN_EXT_OPTIONS_LENGTH + 1;
|
||||
} else {
|
||||
options = null;
|
||||
|
@@ -2216,6 +2216,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Require introducers, because our status is " + status);
|
||||
return true;
|
||||
|
||||
default:
|
||||
if (!allowDirectUDP()) {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
@@ -2226,6 +2227,30 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* MIGHT we require introducers?
|
||||
* This is like introducersRequired, but if we aren't sure, this returns true.
|
||||
* Used only by EstablishmentManager.
|
||||
*
|
||||
* @since 0.9.24
|
||||
*/
|
||||
boolean introducersMaybeRequired() {
|
||||
Status status = getReachabilityStatus();
|
||||
switch (status) {
|
||||
case REJECT_UNSOLICITED:
|
||||
case DIFFERENT:
|
||||
case IPV4_FIREWALLED_IPV6_OK:
|
||||
case IPV4_FIREWALLED_IPV6_UNKNOWN:
|
||||
case IPV4_UNKNOWN_IPV6_OK:
|
||||
case IPV4_UNKNOWN_IPV6_FIREWALLED:
|
||||
case UNKNOWN:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return !allowDirectUDP();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* For EstablishmentManager
|
||||
* @since 0.9.3
|
||||
|
Reference in New Issue
Block a user