mirror of https://bitbucket.org/ausocean/av.git
Merged in additional-logging (pull request #283)
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:
commit
41945c9868
|
@ -247,12 +247,12 @@ func (s *mtsSender) Write(d []byte) (int, error) {
|
||||||
s.curPid = int(p)
|
s.curPid = int(p)
|
||||||
if time.Now().Sub(s.prev) >= s.clipDur && s.curPid == mts.PatPid && len(s.buf) > 0 {
|
if time.Now().Sub(s.prev) >= s.clipDur && s.curPid == mts.PatPid && len(s.buf) > 0 {
|
||||||
s.prev = time.Now()
|
s.prev = time.Now()
|
||||||
_, err := s.ring.Write(s.buf)
|
n, err := s.ring.Write(s.buf)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
s.ring.Flush()
|
s.ring.Flush()
|
||||||
}
|
}
|
||||||
if err != nil {
|
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]
|
s.buf = s.buf[:0]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue