forked from I2P_Developers/i2p.i2p
merge of '577418047ed3ead63f9f7dc4211cf4ac7e19d251'
and 'c5d321a2c838422c5e813359c2e86f9b98561cf9'
This commit is contained in:
@@ -18,6 +18,7 @@ import net.i2p.desktopgui.Main;
|
||||
import net.i2p.router.RouterContext;
|
||||
import net.i2p.util.FileUtil;
|
||||
import net.i2p.util.I2PAppThread;
|
||||
import net.i2p.util.PortMapper;
|
||||
import net.i2p.util.SecureDirectory;
|
||||
import net.i2p.util.SecureFileOutputStream;
|
||||
import net.i2p.util.ShellCommand;
|
||||
@@ -207,6 +208,7 @@ public class RouterConsoleRunner {
|
||||
|
||||
// add standard listeners
|
||||
if (_listenPort != null) {
|
||||
Integer lport = Integer.parseInt(_listenPort);
|
||||
StringTokenizer tok = new StringTokenizer(_listenHost, " ,");
|
||||
while (tok.hasMoreTokens()) {
|
||||
String host = tok.nextToken().trim();
|
||||
@@ -215,7 +217,6 @@ public class RouterConsoleRunner {
|
||||
// _server.addListener('[' + host + "]:" + _listenPort);
|
||||
//else
|
||||
// _server.addListener(host + ':' + _listenPort);
|
||||
Integer lport = Integer.parseInt(_listenPort);
|
||||
InetAddrPort iap = new InetAddrPort(host, lport);
|
||||
SocketListener lsnr = new SocketListener(iap);
|
||||
lsnr.setMinThreads(1); // default 2
|
||||
@@ -230,6 +231,8 @@ public class RouterConsoleRunner {
|
||||
System.err.println("Unable to bind routerconsole to " + host + " port " + _listenPort + ' ' + ioe);
|
||||
}
|
||||
}
|
||||
// XXX: what if listenhosts do not include 127.0.0.1? (Should that ever even happen?)
|
||||
I2PAppContext.getGlobalContext().portMapper().register(PortMapper.SVC_CONSOLE,lport);
|
||||
}
|
||||
|
||||
// add SSL listeners
|
||||
@@ -267,6 +270,7 @@ public class RouterConsoleRunner {
|
||||
System.err.println("Unable to bind routerconsole to " + host + " port " + sslPort + " for SSL: " + e);
|
||||
}
|
||||
}
|
||||
I2PAppContext.getGlobalContext().portMapper().register(PortMapper.SVC_HTTPS_CONSOLE,sslPort);
|
||||
} else {
|
||||
System.err.println("Unable to create or access keystore for SSL: " + keyStore.getAbsolutePath());
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import net.i2p.I2PAppContext;
|
||||
import net.i2p.util.FileUtil;
|
||||
import net.i2p.util.Log;
|
||||
import net.i2p.util.SecureDirectory;
|
||||
import net.i2p.util.PortMapper;
|
||||
|
||||
import org.mortbay.http.HttpContext;
|
||||
import org.mortbay.http.HttpListener;
|
||||
@@ -141,7 +142,7 @@ public class WebAppStarter {
|
||||
Server s = (Server) c.toArray()[i];
|
||||
HttpListener[] hl = s.getListeners();
|
||||
for (int j = 0; j < hl.length; j++) {
|
||||
if (hl[j].getPort() == 7657)
|
||||
if (hl[j].getPort() == I2PAppContext.getGlobalContext().portMapper().getPort(PortMapper.SVC_CONSOLE))
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,10 @@ public class PortMapper {
|
||||
* @return -1 if not registered
|
||||
*/
|
||||
public int getPort(String service) {
|
||||
return getPort(service, -1);
|
||||
int port = getPort(service, -1);
|
||||
if(-1==port)
|
||||
throw new RuntimeException("No port registered for service "+service);
|
||||
return port;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user