forked from I2P_Developers/i2p.i2p
2005-04-05 jrandom
* Retry I2PTunnel startup if we are unable to build a socketManager for a client or httpclient tunnel. * Add some basic sanity checking on the I2CP settings (thanks duck!)
This commit is contained in:
@ -209,8 +209,24 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
|
|||||||
props.putAll(System.getProperties());
|
props.putAll(System.getProperties());
|
||||||
else
|
else
|
||||||
props.putAll(tunnel.getClientOptions());
|
props.putAll(tunnel.getClientOptions());
|
||||||
I2PSocketManager sockManager = I2PSocketManagerFactory.createManager(tunnel.host, Integer.parseInt(tunnel.port), props);
|
int portNum = 7654;
|
||||||
if (sockManager == null) return null;
|
if (tunnel.port != null) {
|
||||||
|
try {
|
||||||
|
portNum = Integer.parseInt(tunnel.port);
|
||||||
|
} catch (NumberFormatException nfe) {
|
||||||
|
_log.log(Log.CRIT, "Invalid port specified [" + tunnel.port + "], reverting to " + portNum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
I2PSocketManager sockManager = null;
|
||||||
|
while (sockManager == null) {
|
||||||
|
sockManager = I2PSocketManagerFactory.createManager(tunnel.host, portNum, props);
|
||||||
|
|
||||||
|
if (sockManager == null) {
|
||||||
|
_log.log(Log.CRIT, "Unable to create socket manager");
|
||||||
|
try { Thread.sleep(10*1000); } catch (InterruptedException ie) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
sockManager.setName("Client");
|
sockManager.setName("Client");
|
||||||
return sockManager;
|
return sockManager;
|
||||||
}
|
}
|
||||||
|
@ -75,9 +75,18 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
|
|||||||
I2PClient client = I2PClientFactory.createClient();
|
I2PClient client = I2PClientFactory.createClient();
|
||||||
Properties props = new Properties();
|
Properties props = new Properties();
|
||||||
props.putAll(getTunnel().getClientOptions());
|
props.putAll(getTunnel().getClientOptions());
|
||||||
|
int portNum = 7654;
|
||||||
|
if (getTunnel().port != null) {
|
||||||
|
try {
|
||||||
|
portNum = Integer.parseInt(getTunnel().port);
|
||||||
|
} catch (NumberFormatException nfe) {
|
||||||
|
_log.log(Log.CRIT, "Invalid port specified [" + getTunnel().port + "], reverting to " + portNum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
while (sockMgr == null) {
|
while (sockMgr == null) {
|
||||||
synchronized (slock) {
|
synchronized (slock) {
|
||||||
sockMgr = I2PSocketManagerFactory.createManager(privData, getTunnel().host, Integer.parseInt(getTunnel().port),
|
sockMgr = I2PSocketManagerFactory.createManager(privData, getTunnel().host, portNum,
|
||||||
props);
|
props);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -258,8 +258,16 @@ public class TunnelController implements Logging {
|
|||||||
if ("localhost".equals(_tunnel.host))
|
if ("localhost".equals(_tunnel.host))
|
||||||
_tunnel.host = "127.0.0.1";
|
_tunnel.host = "127.0.0.1";
|
||||||
String port = getI2CPPort();
|
String port = getI2CPPort();
|
||||||
if ( (port != null) && (port.length() > 0) )
|
if ( (port != null) && (port.length() > 0) ) {
|
||||||
_tunnel.port = port;
|
try {
|
||||||
|
int portNum = Integer.parseInt(port);
|
||||||
|
_tunnel.port = String.valueOf(portNum);
|
||||||
|
} catch (NumberFormatException nfe) {
|
||||||
|
_tunnel.port = "7654";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
_tunnel.port = "7654";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopTunnel() {
|
public void stopTunnel() {
|
||||||
|
@ -36,14 +36,6 @@ public class EditBean extends IndexBean {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getInternalType(int tunnel) {
|
|
||||||
TunnelController tun = getController(tunnel);
|
|
||||||
if (tun != null)
|
|
||||||
return tun.getType();
|
|
||||||
else
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTargetHost(int tunnel) {
|
public String getTargetHost(int tunnel) {
|
||||||
TunnelController tun = getController(tunnel);
|
TunnelController tun = getController(tunnel);
|
||||||
if (tun != null)
|
if (tun != null)
|
||||||
|
@ -311,6 +311,14 @@ public class IndexBean {
|
|||||||
else return internalType;
|
else return internalType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getInternalType(int tunnel) {
|
||||||
|
TunnelController tun = getController(tunnel);
|
||||||
|
if (tun != null)
|
||||||
|
return tun.getType();
|
||||||
|
else
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
public String getClientInterface(int tunnel) {
|
public String getClientInterface(int tunnel) {
|
||||||
TunnelController tun = getController(tunnel);
|
TunnelController tun = getController(tunnel);
|
||||||
if (tun != null)
|
if (tun != null)
|
||||||
@ -532,8 +540,10 @@ public class IndexBean {
|
|||||||
config.setProperty("description", _description);
|
config.setProperty("description", _description);
|
||||||
if (_i2cpHost != null)
|
if (_i2cpHost != null)
|
||||||
config.setProperty("i2cpHost", _i2cpHost);
|
config.setProperty("i2cpHost", _i2cpHost);
|
||||||
if (_i2cpPort != null)
|
if ( (_i2cpPort != null) && (_i2cpPort.trim().length() > 0) )
|
||||||
config.setProperty("i2cpPort", _i2cpPort);
|
config.setProperty("i2cpPort", _i2cpPort);
|
||||||
|
else
|
||||||
|
config.setProperty("i2cpPort", "7654");
|
||||||
|
|
||||||
if (_customOptions != null) {
|
if (_customOptions != null) {
|
||||||
StringTokenizer tok = new StringTokenizer(_customOptions);
|
StringTokenizer tok = new StringTokenizer(_customOptions);
|
||||||
|
@ -118,6 +118,9 @@
|
|||||||
case IndexBean.RUNNING:
|
case IndexBean.RUNNING:
|
||||||
%><b><span style="color:#00dd00">Running</span></b>
|
%><b><span style="color:#00dd00">Running</span></b>
|
||||||
<a href="index.jsp?nonce=<%=indexBean.getNextNonce()%>&action=stop&tunnel=<%=curServer%>">[STOP]</a><%
|
<a href="index.jsp?nonce=<%=indexBean.getNextNonce()%>&action=stop&tunnel=<%=curServer%>">[STOP]</a><%
|
||||||
|
if ("httpserver".equals(indexBean.getInternalType(curServer))) {
|
||||||
|
%> (<a href="http://<%=(new java.util.Random()).nextLong()%>.i2p/?i2paddresshelper=<%=indexBean.getDestinationBase64(curServer)%>">preview</a>)<%
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case IndexBean.NOT_RUNNING:
|
case IndexBean.NOT_RUNNING:
|
||||||
%><b><span style="color:#dd0000">Not Running</span></b>
|
%><b><span style="color:#dd0000">Not Running</span></b>
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
$Id: history.txt,v 1.186 2005/04/03 07:50:12 jrandom Exp $
|
$Id: history.txt,v 1.187 2005/04/05 11:06:16 jrandom Exp $
|
||||||
|
|
||||||
|
2005-04-05 jrandom
|
||||||
|
* Retry I2PTunnel startup if we are unable to build a socketManager for a
|
||||||
|
client or httpclient tunnel.
|
||||||
|
* Add some basic sanity checking on the I2CP settings (thanks duck!)
|
||||||
|
|
||||||
2005-04-05 jrandom
|
2005-04-05 jrandom
|
||||||
* After a successfull netDb search for a leaseSet, republish it to all of
|
* After a successfull netDb search for a leaseSet, republish it to all of
|
||||||
|
@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class RouterVersion {
|
public class RouterVersion {
|
||||||
public final static String ID = "$Revision: 1.179 $ $Date: 2005/04/03 07:50:12 $";
|
public final static String ID = "$Revision: 1.180 $ $Date: 2005/04/05 11:06:15 $";
|
||||||
public final static String VERSION = "0.5.0.5";
|
public final static String VERSION = "0.5.0.5";
|
||||||
public final static long BUILD = 4;
|
public final static long BUILD = 5;
|
||||||
public static void main(String args[]) {
|
public static void main(String args[]) {
|
||||||
System.out.println("I2P Router version: " + VERSION);
|
System.out.println("I2P Router version: " + VERSION);
|
||||||
System.out.println("Router ID: " + RouterVersion.ID);
|
System.out.println("Router ID: " + RouterVersion.ID);
|
||||||
|
@ -475,7 +475,7 @@ public class TunnelPool {
|
|||||||
int added = refreshBuilders();
|
int added = refreshBuilders();
|
||||||
if ( (added > 0) && (_log.shouldLog(Log.WARN)) )
|
if ( (added > 0) && (_log.shouldLog(Log.WARN)) )
|
||||||
_log.warn("Passive rebuilding a tunnel for " + TunnelPool.this.toString());
|
_log.warn("Passive rebuilding a tunnel for " + TunnelPool.this.toString());
|
||||||
requeue(60*1000);
|
requeue(30*1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -269,8 +269,10 @@ public class TunnelPoolManager implements TunnelManagerFacade {
|
|||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
if (_outstandingBuilds >= _maxOutstandingBuilds) {
|
if (_outstandingBuilds >= _maxOutstandingBuilds) {
|
||||||
// ok, as a failsafe, always let one through
|
// ok, as a failsafe, always let one through
|
||||||
_outstandingBuilds++;
|
// nah, its failsafe for a reason. fix the cause.
|
||||||
return 1;
|
//_outstandingBuilds++;
|
||||||
|
//return 1;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
if (_outstandingBuilds + wanted < _maxOutstandingBuilds) {
|
if (_outstandingBuilds + wanted < _maxOutstandingBuilds) {
|
||||||
_outstandingBuilds += wanted;
|
_outstandingBuilds += wanted;
|
||||||
|
Reference in New Issue
Block a user