mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 15:16:51 +08:00
server: allow to call server.Close() twice
This commit is contained in:
@@ -422,6 +422,17 @@ func TestServerHighLevelPublishRead(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestServerClose(t *testing.T) {
|
||||
s := &Server{
|
||||
Handler: &testServerHandler{},
|
||||
}
|
||||
|
||||
err := s.Start("127.0.0.1:8554")
|
||||
require.NoError(t, err)
|
||||
s.Close()
|
||||
s.Close()
|
||||
}
|
||||
|
||||
func TestServerErrorWrongUDPPorts(t *testing.T) {
|
||||
t.Run("non consecutive", func(t *testing.T) {
|
||||
s := &Server{
|
||||
@@ -449,6 +460,7 @@ func TestServerConnClose(t *testing.T) {
|
||||
Handler: &testServerHandler{
|
||||
onConnOpen: func(ctx *ServerHandlerOnConnOpenCtx) {
|
||||
ctx.Conn.Close()
|
||||
ctx.Conn.Close()
|
||||
},
|
||||
onConnClose: func(ctx *ServerHandlerOnConnCloseCtx) {
|
||||
close(connClosed)
|
||||
@@ -887,6 +899,7 @@ func TestServerSessionClose(t *testing.T) {
|
||||
Handler: &testServerHandler{
|
||||
onSessionOpen: func(ctx *ServerHandlerOnSessionOpenCtx) {
|
||||
ctx.Session.Close()
|
||||
ctx.Session.Close()
|
||||
},
|
||||
onSessionClose: func(ctx *ServerHandlerOnSessionCloseCtx) {
|
||||
close(sessionClosed)
|
||||
|
Reference in New Issue
Block a user