Suggestion to improve tracing in nats-server through wrapping errors

Signed-off-by: Matthias Hanel <mh@synadia.com>
This commit is contained in:
Matthias Hanel
2020-02-24 15:43:40 -05:00
parent 62bacf1044
commit d1d34d2638
7 changed files with 143 additions and 5 deletions

View File

@@ -855,9 +855,11 @@ func (c *client) parse(buf []byte) error {
// exact at all but the performance hit is too great to be precise, and
// catching here should prevent memory exhaustion attacks.
if len(c.argBuf) > int(mcl) {
c.sendErr(ErrMaxControlLine.Error())
err := NewErrorCtx(ErrMaxControlLine, "State %d, max_control_line %d, Buffer len %d",
c.state, int(mcl), len(c.argBuf))
c.sendErr(err.Error())
c.closeConnection(MaxControlLineExceeded)
return ErrMaxControlLine
return err
}
}