mirror of https://bitbucket.org/ausocean/av.git
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:
commit
6c39be24c9
|
@ -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")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue