forked from I2P_Developers/i2p.i2p
I meant CREATE
SAM: - Don't publish LS for DIRECTION=RECEIVE - Set default tunnel name
This commit is contained in:
@ -176,6 +176,10 @@ abstract class SAMMessageSession {
|
|||||||
_log.debug("Instantiating new SAM message-based session handler");
|
_log.debug("Instantiating new SAM message-based session handler");
|
||||||
|
|
||||||
I2PClient client = I2PClientFactory.createClient();
|
I2PClient client = I2PClientFactory.createClient();
|
||||||
|
if (!props.containsKey("inbound.nickname") && !props.containsKey("outbound.nickname")) {
|
||||||
|
props.setProperty("inbound.nickname", "SAM UDP Client");
|
||||||
|
props.setProperty("outbound.nickname", "SAM UDP Client");
|
||||||
|
}
|
||||||
session = client.createSession(destStream, props);
|
session = client.createSession(destStream, props);
|
||||||
|
|
||||||
if (_log.shouldLog(Log.DEBUG))
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
|
@ -67,7 +67,7 @@ class SAMStreamSession {
|
|||||||
private final AtomicInteger lastNegativeId = new AtomicInteger();;
|
private final AtomicInteger lastNegativeId = new AtomicInteger();;
|
||||||
|
|
||||||
// Can we create outgoing connections?
|
// Can we create outgoing connections?
|
||||||
protected boolean canCreate;
|
protected final boolean canCreate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* should we flush every time we get a STREAM SEND, or leave that up to
|
* should we flush every time we get a STREAM SEND, or leave that up to
|
||||||
@ -109,6 +109,23 @@ class SAMStreamSession {
|
|||||||
Properties props, SAMStreamReceiver recv) throws IOException, DataFormatException, SAMException {
|
Properties props, SAMStreamReceiver recv) throws IOException, DataFormatException, SAMException {
|
||||||
this.recv = recv;
|
this.recv = recv;
|
||||||
_log = I2PAppContext.getGlobalContext().logManager().getLog(getClass());
|
_log = I2PAppContext.getGlobalContext().logManager().getLog(getClass());
|
||||||
|
|
||||||
|
boolean canReceive;
|
||||||
|
if (dir.equals("BOTH")) {
|
||||||
|
canCreate = true;
|
||||||
|
canReceive = true;
|
||||||
|
} else if (dir.equals("CREATE")) {
|
||||||
|
canCreate = true;
|
||||||
|
canReceive = false;
|
||||||
|
} else if (dir.equals("RECEIVE")) {
|
||||||
|
canCreate = false;
|
||||||
|
canReceive = true;
|
||||||
|
} else {
|
||||||
|
_log.error("BUG! Wrong direction passed to SAMStreamSession: "
|
||||||
|
+ dir);
|
||||||
|
throw new SAMException("BUG! Wrong direction specified!");
|
||||||
|
}
|
||||||
|
|
||||||
if (_log.shouldLog(Log.DEBUG))
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
_log.debug("SAM STREAM session instantiated");
|
_log.debug("SAM STREAM session instantiated");
|
||||||
|
|
||||||
@ -123,6 +140,12 @@ class SAMStreamSession {
|
|||||||
} catch (NumberFormatException nfe) {
|
} catch (NumberFormatException nfe) {
|
||||||
throw new SAMException("Invalid I2CP port specified [" + port + "]");
|
throw new SAMException("Invalid I2CP port specified [" + port + "]");
|
||||||
}
|
}
|
||||||
|
if (!canReceive)
|
||||||
|
allprops.setProperty("i2cp.dontPublishLeaseSet", "true");
|
||||||
|
if (!allprops.containsKey("inbound.nickname") && !allprops.containsKey("outbound.nickname")) {
|
||||||
|
allprops.setProperty("inbound.nickname", "SAM TCP Client");
|
||||||
|
allprops.setProperty("outbound.nickname", "SAM TCP Client");
|
||||||
|
}
|
||||||
|
|
||||||
if (_log.shouldLog(Log.DEBUG))
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
_log.debug("Creating I2PSocketManager...");
|
_log.debug("Creating I2PSocketManager...");
|
||||||
@ -138,19 +161,6 @@ class SAMStreamSession {
|
|||||||
|
|
||||||
forceFlush = Boolean.parseBoolean(allprops.getProperty(PROP_FORCE_FLUSH, DEFAULT_FORCE_FLUSH));
|
forceFlush = Boolean.parseBoolean(allprops.getProperty(PROP_FORCE_FLUSH, DEFAULT_FORCE_FLUSH));
|
||||||
|
|
||||||
boolean canReceive = false;
|
|
||||||
if (dir.equals("BOTH")) {
|
|
||||||
canCreate = true;
|
|
||||||
canReceive = true;
|
|
||||||
} else if (dir.equals("CREATE")) {
|
|
||||||
canCreate = true;
|
|
||||||
} else if (dir.equals("RECEIVE")) {
|
|
||||||
canReceive = true;
|
|
||||||
} else {
|
|
||||||
_log.error("BUG! Wrong direction passed to SAMStreamSession: "
|
|
||||||
+ dir);
|
|
||||||
throw new SAMException("BUG! Wrong direction specified!");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (canReceive) {
|
if (canReceive) {
|
||||||
server = new SAMStreamSessionServer();
|
server = new SAMStreamSessionServer();
|
||||||
|
Reference in New Issue
Block a user