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

This commit is contained in:
Alan Noble 2019-03-03 07:04:33 +00:00
parent 36182d7e6d
commit c15c57f15f
1 changed files with 1 additions and 5 deletions

View File

@ -307,17 +307,13 @@ func (s *rtmpSender) release() {
}
func (s *rtmpSender) restart() error {
err := s.conn.Close()
if err != nil {
return err
}
s.conn.Close()
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")
}