diff --git a/server/accounts.go b/server/accounts.go index 3f59db88..100f6f07 100644 --- a/server/accounts.go +++ b/server/accounts.go @@ -2060,7 +2060,7 @@ func (a *Account) createRespWildcard() []byte { a.prand = rand.New(rand.NewSource(time.Now().UnixNano())) } var b = [baseServerLen]byte{'_', 'R', '_', '.'} - rn := a.prand.Int63() + rn := a.prand.Uint64() for i, l := replyPrefixLen, rn; i < len(b); i++ { b[i] = digits[l%base] l /= base @@ -2088,17 +2088,19 @@ func isTrackedReply(reply []byte) bool { // Generate a new service reply from the wildcard prefix. // FIXME(dlc) - probably do not have to use rand here. about 25ns per. func (a *Account) newServiceReply(tracking bool) []byte { - a.mu.RLock() - replyPre := a.siReply - s := a.srv - a.mu.RUnlock() + a.mu.Lock() + s, replyPre := a.srv, a.siReply + if a.prand == nil { + a.prand = rand.New(rand.NewSource(time.Now().UnixNano())) + } + rn := a.prand.Uint64() + a.mu.Unlock() if replyPre == nil { replyPre = a.createRespWildcard() } var b [replyLen]byte - rn := a.prand.Int63() for i, l := 0, rn; i < len(b); i++ { b[i] = digits[l%base] l /= base diff --git a/server/jetstream_cluster_test.go b/server/jetstream_cluster_test.go index f7d2dae1..a1aecb68 100644 --- a/server/jetstream_cluster_test.go +++ b/server/jetstream_cluster_test.go @@ -6345,7 +6345,7 @@ func TestJetStreamClusterDomainsAndAPIResponses(t *testing.T) { // Now create spoke LN cluster. tmpl = strings.Replace(jsClusterTemplWithLeafNode, "store_dir:", "domain: SPOKE, store_dir:", 1) - lnc := c.createLeafNodesWithTemplateAndStartPort(tmpl, "SPOKE", 5, 33113) + lnc := c.createLeafNodesWithTemplateAndStartPort(tmpl, "SPOKE", 5, 33913) defer lnc.shutdown() lnc.waitOnClusterReady()