Allow Java mdp protocols to specify the port to listen on

This commit is contained in:
Jeremy Lakeman 2014-09-15 14:39:26 +09:30
parent 2c72875508
commit 12c02255a1
2 changed files with 8 additions and 1 deletions

View File

@ -13,8 +13,11 @@ public abstract class AbstractMdpProtocol<T> extends ChannelSelector.Handler {
protected final AsyncResult<T> results;
public AbstractMdpProtocol(ChannelSelector selector, int loopbackMdpPort, AsyncResult<T> results) throws IOException {
this(selector, loopbackMdpPort, results, 0);
}
public AbstractMdpProtocol(ChannelSelector selector, int loopbackMdpPort, AsyncResult<T> results, int port) throws IOException {
this.socket = new MdpSocket(loopbackMdpPort);
socket.bind();
socket.bind(port);
this.selector = selector;
this.results = results;
selector.register(this);

View File

@ -31,6 +31,10 @@ public class ServerControl {
return this.execPath;
}
public int getLoopbackMdpPort() {
return loopbackMdpPort;
}
private void setStatus(ServalDCommand.Status result){
loopbackMdpPort = result.mdpInetPort;
pid = result.pid;