revid: fixed mtsSender's output routine's logic

This commit is contained in:
Saxon 2019-04-10 12:19:28 +09:30
parent 3841b8cb5b
commit 9a52f19e3d
1 changed files with 12 additions and 14 deletions

View File

@ -183,7 +183,6 @@ func newMtsSender(dst io.WriteCloser, log func(lvl int8, msg string, args ...int
// output starts an mtsSender's data handling routine.
func (s *mtsSender) output() {
var chunk *ring.Chunk
loop:
for {
select {
case <-s.quit:
@ -197,6 +196,7 @@ loop:
chunk, err = s.ringBuf.Next(readTimeout)
switch err {
case nil:
continue
case ring.ErrTimeout:
s.log(logger.Debug, pkg+"mtsSender: ring buffer read timeout")
continue
@ -204,10 +204,9 @@ loop:
s.log(logger.Error, pkg+"mtsSender: unexpected error", "error", err.Error())
fallthrough
case io.EOF:
goto loop
continue
}
}
// If chunk is not nil, then we need to try sending it off.
} else {
err := s.repairer.Repair(chunk.Bytes())
if err != nil {
chunk.Close()
@ -223,7 +222,6 @@ loop:
chunk = nil
}
}
}
}
// Write implements io.Writer.