[FIXED] trace/debug/sys_log reload will affect existing clients

Fixed #1296, by altering client state on reload

Detect a trace level change on reload and update all clients.
To avoid data races, read client.trace while holding the lock,
pass the value into functionis that trace while not holding the lock.
Delete unused client.debug.

Signed-off-by: Matthias Hanel <mh@synadia.com>
This commit is contained in:
Matthias Hanel
2020-03-01 21:28:23 -05:00
parent 34e4c64e50
commit f5bd07b36c
11 changed files with 363 additions and 90 deletions

View File

@@ -301,7 +301,7 @@ func TestParsePubArg(t *testing.T) {
subject: "foo", reply: "", size: 2222, szb: "2222"},
} {
t.Run(test.arg, func(t *testing.T) {
if err := c.processPub(false, []byte(test.arg)); err != nil {
if err := c.processPub([]byte(test.arg), false); err != nil {
t.Fatalf("Unexpected parse error: %v\n", err)
}
if !bytes.Equal(c.pa.subject, []byte(test.subject)) {
@@ -324,7 +324,7 @@ func TestParsePubBadSize(t *testing.T) {
c := dummyClient()
// Setup localized max payload
c.mpay = 32768
if err := c.processPub(false, []byte("foo 2222222222222222")); err == nil {
if err := c.processPub([]byte("foo 2222222222222222"), false); err == nil {
t.Fatalf("Expected parse error for size too large")
}
}