From f28409ee272fdb989d28083aa19dfb29e9fda2b2 Mon Sep 17 00:00:00 2001 From: Andrew Bayer Date: Thu, 21 Apr 2011 12:48:09 -0700 Subject: [PATCH] [FIXED JENKINS-9230] Added unique instance identifier to UDP broadcast and DNS multicast. --- changelog.html | 3 +++ core/src/main/java/hudson/DNSMultiCast.java | 3 +++ core/src/main/java/hudson/UDPBroadcastThread.java | 2 ++ 3 files changed, 8 insertions(+) diff --git a/changelog.html b/changelog.html index 999bc81113..bf7a1d1a0d 100644 --- a/changelog.html +++ b/changelog.html @@ -65,6 +65,9 @@ Upcoming changes
  • Fixed a persistence problem in View$PropertyList (issue 9367) +
  • + Added unique instance identifier to UDP broadcast and DNS multicast information. + (issue 9230)
  • Maven agent needs a fix for the 'hardcoded' socket connection to localhost (issue 6795) diff --git a/core/src/main/java/hudson/DNSMultiCast.java b/core/src/main/java/hudson/DNSMultiCast.java index e6065d74e1..f5c33a3edf 100644 --- a/core/src/main/java/hudson/DNSMultiCast.java +++ b/core/src/main/java/hudson/DNSMultiCast.java @@ -1,6 +1,7 @@ package hudson; import hudson.model.Hudson; +import hudson.Util; import javax.jmdns.JmDNS; import javax.jmdns.ServiceInfo; @@ -39,6 +40,8 @@ public class DNSMultiCast implements Closeable { if (tal!=null) props.put("slave-port",String.valueOf(tal.getPort())); + props.put("server-id", Util.getDigestOf(hudson.getSecretKey())); + jmdns.registerService(ServiceInfo.create("_hudson._tcp.local.","hudson", 80,0,0,props)); // for backward compatibility jmdns.registerService(ServiceInfo.create("_jenkins._tcp.local.","jenkins", diff --git a/core/src/main/java/hudson/UDPBroadcastThread.java b/core/src/main/java/hudson/UDPBroadcastThread.java index bb1e3e8965..877e3604ac 100644 --- a/core/src/main/java/hudson/UDPBroadcastThread.java +++ b/core/src/main/java/hudson/UDPBroadcastThread.java @@ -25,6 +25,7 @@ package hudson; import hudson.model.Hudson; import hudson.util.OneShotEvent; +import hudson.Util; import java.io.IOException; import java.net.BindException; @@ -77,6 +78,7 @@ public class UDPBroadcastThread extends Thread { StringBuilder rsp = new StringBuilder(""); tag(rsp,"version",Hudson.VERSION); tag(rsp,"url",hudson.getRootUrl()); + tag(rsp,"server-id", Util.getDigestOf(hudson.getSecretKey())); tag(rsp,"slave-port",tal==null?null:tal.getPort()); for (UDPBroadcastFragment f : UDPBroadcastFragment.all()) -- GitLab