revid: changed close operation on destination to close operpation on slice ofoperations in reset()

This commit is contained in:
saxon 2018-11-25 17:24:52 +10:30
parent 219cafc032
commit a4ded5337d
1 changed files with 8 additions and 5 deletions

View File

@ -118,7 +118,7 @@ type Revid struct {
// to the target destination. // to the target destination.
buffer *ring.Buffer buffer *ring.Buffer
// destination is the target endpoint. // destination is the target endpoint.
destination loadSender destination []loadSender
// bitrate hold the last send bitrate calculation result. // bitrate hold the last send bitrate calculation result.
bitrate int bitrate int
@ -200,12 +200,15 @@ func (r *Revid) reset(config Config) error {
} }
r.config = config r.config = config
if r.destination != nil { for i, destination := range r.destination {
err = r.destination.close() if destination != nil {
err = destination.close()
if err != nil { if err != nil {
r.config.Logger.Log(smartlogger.Error, pkg+"could not close destination", "error", err.Error()) return err
} }
} }
}
switch r.config.Output { switch r.config.Output {
case File: case File:
s, err := newFileSender(config.OutputFileName) s, err := newFileSender(config.OutputFileName)