diff --git a/revid/senders.go b/revid/senders.go index 9d326471..1e97aad1 100644 --- a/revid/senders.go +++ b/revid/senders.go @@ -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") }