cleanup log

This commit is contained in:
aler9 2021-05-08 22:30:22 +02:00
parent 4da59604e1
commit 8531fc49dc
3 changed files with 6 additions and 9 deletions

2
go.mod
View File

@ -5,7 +5,7 @@ go 1.15
require (
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d // indirect
github.com/aler9/gortsplib v0.0.0-20210508200522-b98fa90057b4
github.com/aler9/gortsplib v0.0.0-20210508202705-7469a3362a7d
github.com/asticode/go-astits v0.0.0-00010101000000-000000000000
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fsnotify/fsnotify v1.4.9

4
go.sum
View File

@ -4,8 +4,8 @@ github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d h1:UQZhZ2O0vMHr2c
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
github.com/aler9/go-astits v0.0.0-20210423195926-582b09ed7c04 h1:CXgQLsU4uxWAmsXNOjGLbj0A+0IlRcpZpMgI13fmVwo=
github.com/aler9/go-astits v0.0.0-20210423195926-582b09ed7c04/go.mod h1:DkOWmBNQpnr9mv24KfZjq4JawCFX1FCqjLVGvO0DygQ=
github.com/aler9/gortsplib v0.0.0-20210508200522-b98fa90057b4 h1:mL4yLi09Bpph+cLlXdU6CJAsIox9a5grz4ik4M3Q9ik=
github.com/aler9/gortsplib v0.0.0-20210508200522-b98fa90057b4/go.mod h1:zVCg+TQX445hh1pC5QgAuuBvvXZMWLY1XYz626dGFqY=
github.com/aler9/gortsplib v0.0.0-20210508202705-7469a3362a7d h1:c9eARLYpLvZM6WX7TLIgp1z7NvpYxK4ceFdx62te6YU=
github.com/aler9/gortsplib v0.0.0-20210508202705-7469a3362a7d/go.mod h1:zVCg+TQX445hh1pC5QgAuuBvvXZMWLY1XYz626dGFqY=
github.com/aler9/rtmp v0.0.0-20210403095203-3be4a5535927 h1:95mXJ5fUCYpBRdSOnLAQAdJHHKxxxJrVCiaqDi965YQ=
github.com/aler9/rtmp v0.0.0-20210403095203-3be4a5535927/go.mod h1:vzuE21rowz+lT1NGsWbreIvYulgBpCGnQyeTyFblUHc=
github.com/asticode/go-astikit v0.20.0 h1:+7N+J4E4lWx2QOkRdOf6DafWJMv6O4RRfgClwQokrH8=

View File

@ -23,8 +23,6 @@ const (
pauseAfterAuthError = 2 * time.Second
)
var errTerminated = errors.New("terminated")
func isTeardownErr(err error) bool {
_, ok := err.(liberrors.ErrServerSessionTeardown)
return ok
@ -97,7 +95,7 @@ func New(
// Close closes a Client.
func (c *Client) Close(err error) {
if err != io.EOF && err != errTerminated && !isTeardownErr(err) {
if err != io.EOF && !isTeardownErr(err) {
c.log(logger.Info, "ERR: %v", err)
}
@ -152,11 +150,10 @@ func (c *Client) OnDescribe(ctx *gortsplib.ServerHandlerOnDescribeCtx) (*base.Re
return terr.Response, nil, nil
case readpublisher.ErrAuthCritical:
c.log(logger.Info, "ERR: %v", terr.Message)
// wait some seconds to stop brute force attacks
<-time.After(pauseAfterAuthError)
return terr.Response, nil, errTerminated
return terr.Response, nil, errors.New(terr.Message)
case readpublisher.ErrNoOnePublishing:
return &base.Response{