diff --git a/apps/nsqadmin/main.go b/apps/nsqadmin/main.go index 2b0638233..328ac3527 100644 --- a/apps/nsqadmin/main.go +++ b/apps/nsqadmin/main.go @@ -10,10 +10,10 @@ import ( "time" "github.com/BurntSushi/toml" + "github.com/mreiferson/go-options" "github.com/nsqio/nsq/internal/app" "github.com/nsqio/nsq/internal/version" "github.com/nsqio/nsq/nsqadmin" - "github.com/mreiferson/go-options" ) var ( diff --git a/internal/clusterinfo/data.go b/internal/clusterinfo/data.go index 87da1f5b7..d7d9b39a6 100644 --- a/internal/clusterinfo/data.go +++ b/internal/clusterinfo/data.go @@ -3,8 +3,10 @@ package clusterinfo import ( "errors" "fmt" + "net" "net/url" "sort" + "strconv" "strings" "sync" @@ -495,6 +497,15 @@ func (c *ClusterInfo) GetNSQDTopicProducers(topic string, nsqdHTTPAddrs []string version, _ = semver.Parse("0.0.0") } + // if BroadcastAddress/HTTPPort are missing, use the values from `addr` for + // backwards compatibility + + if infoResp.BroadcastAddress == "" { + var p string + infoResp.BroadcastAddress, p, _ = net.SplitHostPort(addr) + infoResp.HTTPPort, _ = strconv.Atoi(p) + } + lock.Lock() producers = append(producers, &Producer{ Version: infoResp.Version,