提交 06db9b86 编写于 作者: V Vincent Latombe

Merge pull request #2189 from yp-engineering/fix_jnlp_advertised_port

Fix advertised JNLP Port
......@@ -1925,7 +1925,7 @@ public class Functions {
TcpSlaveAgentListener tal = j.tcpSlaveAgentListener;
if (tal !=null) {
int p = TcpSlaveAgentListener.CLI_PORT !=null ? TcpSlaveAgentListener.CLI_PORT : tal.getPort();
int p = tal.getAdvertisedPort();
rsp.setIntHeader("X-Hudson-CLI-Port", p);
rsp.setIntHeader("X-Jenkins-CLI-Port", p);
rsp.setIntHeader("X-Jenkins-CLI2-Port", p);
......
......@@ -94,6 +94,13 @@ public final class TcpSlaveAgentListener extends Thread {
return serverSocket.socket().getLocalPort();
}
/**
* Gets the TCP port number in which we are advertising.
*/
public int getAdvertisedPort() {
return CLI_PORT != null ? CLI_PORT : getPort();
}
@Override
public void run() {
try {
......
......@@ -28,8 +28,8 @@ THE SOFTWARE.
Publicize the TCP port number for JNLP slave agents so that they know where to conenct.
Keep the legacy header for better backward compatibility
-->
<st:header name="X-Hudson-JNLP-Port" value="${app.tcpSlaveAgentListener.port}" />
<st:header name="X-Jenkins-JNLP-Port" value="${app.tcpSlaveAgentListener.port}" />
<st:header name="X-Hudson-JNLP-Port" value="${app.tcpSlaveAgentListener.advertisedPort}" />
<st:header name="X-Jenkins-JNLP-Port" value="${app.tcpSlaveAgentListener.advertisedPort}" />
<!--
if the host name is overriden, advertise that as well
-->
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册