server: move address into Server struct

This commit is contained in:
aler9
2021-10-30 16:24:04 +02:00
committed by Alessandro Ros
parent 2882bacdf2
commit 1f5dec4a02
6 changed files with 115 additions and 66 deletions

View File

@@ -105,9 +105,10 @@ func TestServerReadSetupPath(t *testing.T) {
}, stream, nil
},
},
RTSPAddress: "localhost:8554",
}
err = s.Start("localhost:8554")
err = s.Start()
require.NoError(t, err)
defer s.Wait()
defer s.Close()
@@ -170,9 +171,10 @@ func TestServerReadSetupErrors(t *testing.T) {
}, stream, nil
},
},
RTSPAddress: "localhost:8554",
}
err = s.Start("localhost:8554")
err = s.Start()
require.NoError(t, err)
defer s.Wait()
defer s.Close()
@@ -273,6 +275,8 @@ func TestServerRead(t *testing.T) {
counter := uint64(0)
listenIP := multicastCapableIP(t)
s := &Server{
Handler: &testServerHandler{
onConnOpen: func(ctx *ServerHandlerOnConnOpenCtx) {
@@ -319,6 +323,7 @@ func TestServerRead(t *testing.T) {
}, nil
},
},
RTSPAddress: listenIP + ":8554",
}
switch transport {
@@ -337,8 +342,7 @@ func TestServerRead(t *testing.T) {
s.TLSConfig = &tls.Config{Certificates: []tls.Certificate{cert}}
}
listenIP := multicastCapableIP(t)
err = s.Start(listenIP + ":8554")
err = s.Start()
require.NoError(t, err)
defer s.Wait()
defer s.Close()
@@ -595,9 +599,10 @@ func TestServerReadNonStandardFrameSize(t *testing.T) {
}, nil
},
},
RTSPAddress: "localhost:8554",
}
err = s.Start("localhost:8554")
err = s.Start()
require.NoError(t, err)
defer s.Wait()
defer s.Close()
@@ -767,9 +772,10 @@ func TestServerReadPlayPlay(t *testing.T) {
},
UDPRTPAddress: "127.0.0.1:8000",
UDPRTCPAddress: "127.0.0.1:8001",
RTSPAddress: "localhost:8554",
}
err = s.Start("localhost:8554")
err = s.Start()
require.NoError(t, err)
defer s.Wait()
defer s.Close()
@@ -875,9 +881,10 @@ func TestServerReadPlayPausePlay(t *testing.T) {
}, nil
},
},
RTSPAddress: "localhost:8554",
}
err = s.Start("localhost:8554")
err = s.Start()
require.NoError(t, err)
defer s.Wait()
defer s.Close()
@@ -990,9 +997,10 @@ func TestServerReadPlayPausePause(t *testing.T) {
}, nil
},
},
RTSPAddress: "localhost:8554",
}
err = s.Start("localhost:8554")
err = s.Start()
require.NoError(t, err)
defer s.Wait()
defer s.Close()
@@ -1100,12 +1108,12 @@ func TestServerReadTimeout(t *testing.T) {
},
ReadTimeout: 1 * time.Second,
closeSessionAfterNoRequestsFor: 1 * time.Second,
UDPRTPAddress: "127.0.0.1:8000",
UDPRTCPAddress: "127.0.0.1:8001",
RTSPAddress: "localhost:8554",
}
s.UDPRTPAddress = "127.0.0.1:8000"
s.UDPRTCPAddress = "127.0.0.1:8001"
err = s.Start("localhost:8554")
err = s.Start()
require.NoError(t, err)
defer s.Wait()
defer s.Close()
@@ -1196,6 +1204,7 @@ func TestServerReadWithoutTeardown(t *testing.T) {
},
ReadTimeout: 1 * time.Second,
closeSessionAfterNoRequestsFor: 1 * time.Second,
RTSPAddress: "localhost:8554",
}
if transport == "udp" {
@@ -1203,7 +1212,7 @@ func TestServerReadWithoutTeardown(t *testing.T) {
s.UDPRTCPAddress = "127.0.0.1:8001"
}
err = s.Start("localhost:8554")
err = s.Start()
require.NoError(t, err)
defer s.Wait()
defer s.Close()
@@ -1288,9 +1297,10 @@ func TestServerReadUDPChangeConn(t *testing.T) {
},
UDPRTPAddress: "127.0.0.1:8000",
UDPRTCPAddress: "127.0.0.1:8001",
RTSPAddress: "localhost:8554",
}
err = s.Start("localhost:8554")
err = s.Start()
require.NoError(t, err)
defer s.Wait()
defer s.Close()
@@ -1380,9 +1390,10 @@ func TestServerReadErrorUDPSamePorts(t *testing.T) {
},
UDPRTPAddress: "127.0.0.1:8000",
UDPRTCPAddress: "127.0.0.1:8001",
RTSPAddress: "localhost:8554",
}
err = s.Start("localhost:8554")
err = s.Start()
require.NoError(t, err)
defer s.Wait()
defer s.Close()
@@ -1486,9 +1497,10 @@ func TestServerReadNonSetuppedPath(t *testing.T) {
}, nil
},
},
RTSPAddress: "localhost:8554",
}
err = s.Start("localhost:8554")
err = s.Start()
require.NoError(t, err)
defer s.Wait()
defer s.Close()
@@ -1651,9 +1663,10 @@ func TestServerReadAdditionalInfos(t *testing.T) {
}, nil
},
},
RTSPAddress: "localhost:8554",
}
err = s.Start("localhost:8554")
err = s.Start()
require.NoError(t, err)
defer s.Wait()
defer s.Close()