client: support reading from servers that use random UDP ports (https://github.com/aler9/rtsp-simple-server/issues/691)

This commit is contained in:
aler9
2021-11-13 10:13:54 +01:00
parent d205c00878
commit ba7f9aff25
3 changed files with 11 additions and 5 deletions

View File

@@ -792,6 +792,7 @@ func TestClientReadAnyPort(t *testing.T) {
"zero",
"zero_one",
"no",
"random",
} {
t.Run(ca, func(t *testing.T) {
l, err := net.Listen("tcp", "localhost:8554")
@@ -868,8 +869,13 @@ func TestClientReadAnyPort(t *testing.T) {
case "zero_one":
return &[2]int{0, 1}
case "no":
return nil
default: // random
return &[2]int{23040, 23041}
}
return nil
}(),
}.Write(),
},
@@ -887,7 +893,7 @@ func TestClientReadAnyPort(t *testing.T) {
time.Sleep(1 * time.Second)
l1, err := net.ListenPacket("udp", "localhost:0")
l1, err := net.ListenPacket("udp", "localhost:13344")
require.NoError(t, err)
defer l1.Close()