Some update to leafnode subscription handling

- Send all subs in place if smap is small
- Skip sending update until after sendAllLeafSubs() is done

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
This commit is contained in:
Ivan Kozlovic
2019-10-30 20:01:49 -06:00
parent 636ff95627
commit cbbc21ac25
4 changed files with 31 additions and 13 deletions

View File

@@ -747,9 +747,17 @@ func TestLeafNodeGatewayInterestPropagation(t *testing.T) {
lc := createLeafConn(t, opts.LeafNode.Host, opts.LeafNode.Port)
defer lc.Close()
_, leafExpect := setupConn(t, lc)
buf := leafExpect(lsubRe)
if !strings.Contains(string(buf), "foo") {
t.Fatalf("Expected interest for 'foo' as 'LS+ foo\\r\\n', got %q", buf)
var totalBuf []byte
for count := 0; count != 3; {
buf := leafExpect(lsubRe)
totalBuf = append(totalBuf, buf...)
count += len(lsubRe.FindAllSubmatch(buf, -1))
if count > 3 {
t.Fatalf("Expected %v matches, got %v (buf=%s)", 3, count, totalBuf)
}
}
if !strings.Contains(string(totalBuf), "foo") {
t.Fatalf("Expected interest for 'foo' as 'LS+ foo\\r\\n', got %q", totalBuf)
}
}