Add hooks so the new PortMapper lets i2p plugins not fail when the router console is not on port 7657. Also raise an exception when requesting unregistered ports so as to encourage swift adding of the registration hooks when those ports are taken.

This commit is contained in:
dream
2011-12-15 23:36:32 +00:00
parent 51e4003089
commit 212981dfee
3 changed files with 11 additions and 3 deletions

View File

@ -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;
}
}