Merged in revid/fix-close-calls (pull request #156)

Don't fail if Close() returns an error, since it just means there is no connection, and don't call Close when Dial fails.

Approved-by: Saxon Milton <saxon.milton@gmail.com>
Approved-by: Alan Noble <anoble@gmail.com>
This commit is contained in:
Alan Noble 2019-03-03 07:12:08 +00:00
commit 6c39be24c9
1 changed files with 2 additions and 5 deletions

View File

@ -307,17 +307,14 @@ func (s *rtmpSender) release() {
}
func (s *rtmpSender) restart() error {
err := s.conn.Close()
if err != nil {
return err
}
s.conn.Close()
var err error
for n := 0; n < s.retries; n++ {
s.conn, err = rtmp.Dial(s.url, s.timeout, s.log)
if err == nil {
break
}
s.log(logger.Error, err.Error())
s.conn.Close()
if n < s.retries-1 {
s.log(logger.Info, pkg+"retry rtmp connection")
}