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