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 {
|
func (s *rtmpSender) restart() error {
|
||||||
err := s.conn.Close()
|
s.conn.Close()
|
||||||
if err != nil {
|
var err error
|
||||||
return err
|
|
||||||
}
|
|
||||||
for n := 0; n < s.retries; n++ {
|
for n := 0; n < s.retries; n++ {
|
||||||
s.conn, err = rtmp.Dial(s.url, s.timeout, s.log)
|
s.conn, err = rtmp.Dial(s.url, s.timeout, s.log)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
s.log(logger.Error, err.Error())
|
s.log(logger.Error, err.Error())
|
||||||
s.conn.Close()
|
|
||||||
if n < s.retries-1 {
|
if n < s.retries-1 {
|
||||||
s.log(logger.Info, pkg+"retry rtmp connection")
|
s.log(logger.Info, pkg+"retry rtmp connection")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue