forked from I2P_Developers/i2p.i2p
SAM: Fix v3 bug accepting incoming connections
It was starting both the v3 and v1 acceptors.
This commit is contained in:
@ -82,7 +82,7 @@ class SAMStreamSession {
|
|||||||
* Create a new SAM STREAM session.
|
* Create a new SAM STREAM session.
|
||||||
*
|
*
|
||||||
* @param dest Base64-encoded destination and private keys (same format as PrivateKeyFile)
|
* @param dest Base64-encoded destination and private keys (same format as PrivateKeyFile)
|
||||||
* @param dir Session direction ("RECEIVE", "CREATE" or "BOTH")
|
* @param dir Session direction ("RECEIVE", "CREATE" or "BOTH") or "__v3__" if extended by SAMv3StreamSession
|
||||||
* @param props Properties to setup the I2P session
|
* @param props Properties to setup the I2P session
|
||||||
* @param recv Object that will receive incoming data
|
* @param recv Object that will receive incoming data
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
@ -98,7 +98,7 @@ class SAMStreamSession {
|
|||||||
* Create a new SAM STREAM session.
|
* Create a new SAM STREAM session.
|
||||||
*
|
*
|
||||||
* @param destStream Input stream containing the destination and private keys (same format as PrivateKeyFile)
|
* @param destStream Input stream containing the destination and private keys (same format as PrivateKeyFile)
|
||||||
* @param dir Session direction ("RECEIVE", "CREATE" or "BOTH")
|
* @param dir Session direction ("RECEIVE", "CREATE" or "BOTH") or "__v3__" if extended by SAMv3StreamSession
|
||||||
* @param props Properties to setup the I2P session
|
* @param props Properties to setup the I2P session
|
||||||
* @param recv Object that will receive incoming data
|
* @param recv Object that will receive incoming data
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
@ -111,15 +111,24 @@ class SAMStreamSession {
|
|||||||
_log = I2PAppContext.getGlobalContext().logManager().getLog(getClass());
|
_log = I2PAppContext.getGlobalContext().logManager().getLog(getClass());
|
||||||
|
|
||||||
boolean canReceive;
|
boolean canReceive;
|
||||||
|
boolean startAcceptor;
|
||||||
if (dir.equals("BOTH")) {
|
if (dir.equals("BOTH")) {
|
||||||
canCreate = true;
|
canCreate = true;
|
||||||
canReceive = true;
|
canReceive = true;
|
||||||
|
startAcceptor = true;
|
||||||
|
} else if (dir.equals("__v3__")) {
|
||||||
|
// we are super to SAMv3StreamSession, don't start thread, he handles it
|
||||||
|
canCreate = true;
|
||||||
|
canReceive = true;
|
||||||
|
startAcceptor = false;
|
||||||
} else if (dir.equals("CREATE")) {
|
} else if (dir.equals("CREATE")) {
|
||||||
canCreate = true;
|
canCreate = true;
|
||||||
canReceive = false;
|
canReceive = false;
|
||||||
|
startAcceptor = false;
|
||||||
} else if (dir.equals("RECEIVE")) {
|
} else if (dir.equals("RECEIVE")) {
|
||||||
canCreate = false;
|
canCreate = false;
|
||||||
canReceive = true;
|
canReceive = true;
|
||||||
|
startAcceptor = true;
|
||||||
} else {
|
} else {
|
||||||
_log.error("BUG! Wrong direction passed to SAMStreamSession: "
|
_log.error("BUG! Wrong direction passed to SAMStreamSession: "
|
||||||
+ dir);
|
+ dir);
|
||||||
@ -162,7 +171,7 @@ class SAMStreamSession {
|
|||||||
forceFlush = Boolean.parseBoolean(allprops.getProperty(PROP_FORCE_FLUSH, DEFAULT_FORCE_FLUSH));
|
forceFlush = Boolean.parseBoolean(allprops.getProperty(PROP_FORCE_FLUSH, DEFAULT_FORCE_FLUSH));
|
||||||
|
|
||||||
|
|
||||||
if (canReceive) {
|
if (startAcceptor) {
|
||||||
server = new SAMStreamSessionServer();
|
server = new SAMStreamSessionServer();
|
||||||
Thread t = new I2PAppThread(server, "SAMStreamSessionServer");
|
Thread t = new I2PAppThread(server, "SAMStreamSessionServer");
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ class SAMv3StreamSession extends SAMStreamSession implements SAMv3Handler.Sessi
|
|||||||
public SAMv3StreamSession(String login)
|
public SAMv3StreamSession(String login)
|
||||||
throws IOException, DataFormatException, SAMException
|
throws IOException, DataFormatException, SAMException
|
||||||
{
|
{
|
||||||
super(getDB().get(login).getDest(), "BOTH",
|
super(getDB().get(login).getDest(), "__v3__",
|
||||||
getDB().get(login).getProps(),
|
getDB().get(login).getProps(),
|
||||||
getDB().get(login).getHandler());
|
getDB().get(login).getHandler());
|
||||||
this.nick = login ;
|
this.nick = login ;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
2014-11-22 zzz
|
2014-11-22 zzz
|
||||||
* PeerSelector: If non-DSA, don't use incompatible peers
|
* PeerSelector: If non-DSA, don't use incompatible peers
|
||||||
for exploratory tunnels or closest-hop in client tunnels
|
for exploratory tunnels or closest-hop in client tunnels
|
||||||
|
* SAM: Fix v3 bug accepting incoming connections
|
||||||
|
|
||||||
2014-11-17 zzz
|
2014-11-17 zzz
|
||||||
* NetDB: Exclude A1/A2 "countries" from auto-floodfill
|
* NetDB: Exclude A1/A2 "countries" from auto-floodfill
|
||||||
|
@ -18,7 +18,7 @@ public class RouterVersion {
|
|||||||
/** deprecated */
|
/** deprecated */
|
||||||
public final static String ID = "Monotone";
|
public final static String ID = "Monotone";
|
||||||
public final static String VERSION = CoreVersion.VERSION;
|
public final static String VERSION = CoreVersion.VERSION;
|
||||||
public final static long BUILD = 8;
|
public final static long BUILD = 9;
|
||||||
|
|
||||||
/** for example "-test" */
|
/** for example "-test" */
|
||||||
public final static String EXTRA = "-rc";
|
public final static String EXTRA = "-rc";
|
||||||
|
Reference in New Issue
Block a user