Merged in additional-logging (pull request )

Log size along with ring buffer error

Approved-by: kortschak <dan@kortschak.io>
Approved-by: Saxon Milton <saxon.milton@gmail.com>
Approved-by: Alan Noble <anoble@gmail.com>
This commit is contained in:
Alan Noble 2019-11-22 03:28:05 +00:00
commit 41945c9868
1 changed files with 2 additions and 2 deletions

View File

@ -247,12 +247,12 @@ func (s *mtsSender) Write(d []byte) (int, error) {
s.curPid = int(p)
if time.Now().Sub(s.prev) >= s.clipDur && s.curPid == mts.PatPid && len(s.buf) > 0 {
s.prev = time.Now()
_, err := s.ring.Write(s.buf)
n, err := s.ring.Write(s.buf)
if err == nil {
s.ring.Flush()
}
if err != nil {
s.log(logger.Warning, pkg+"mtsSender: ringBuffer write error", "error", err.Error())
s.log(logger.Warning, pkg+"mtsSender: ringBuffer write error", "error", err.Error(), "n", n, "size", len(s.buf))
}
s.buf = s.buf[:0]
}