diff --git a/pkg/liberrors/server.go b/pkg/liberrors/server.go index 865e5b6d..f79cc708 100644 --- a/pkg/liberrors/server.go +++ b/pkg/liberrors/server.go @@ -242,7 +242,7 @@ type ErrServerUDPPortsAlreadyInUse struct { // Error implements the error interface. func (e ErrServerUDPPortsAlreadyInUse) Error() string { - return fmt.Sprintf("UDP ports %d and %d are already assigned to another reader", + return fmt.Sprintf("UDP ports %d and %d are already assigned to another reader with the same IP", e.Port, e.Port+1) } diff --git a/server_read_test.go b/server_read_test.go index 1bfe1b3e..b470cfea 100644 --- a/server_read_test.go +++ b/server_read_test.go @@ -280,7 +280,7 @@ func TestServerReadSetupErrors(t *testing.T) { } } -func TestServerReadSetupErrorSameUDPPorts(t *testing.T) { +func TestServerReadSetupErrorSameUDPPortsAndIP(t *testing.T) { track := &TrackH264{ PayloadType: 96, SPS: []byte{0x01, 0x02, 0x03, 0x04}, @@ -295,7 +295,8 @@ func TestServerReadSetupErrorSameUDPPorts(t *testing.T) { Handler: &testServerHandler{ onConnClose: func(ctx *ServerHandlerOnConnCloseCtx) { if atomic.SwapInt32(&first, 0) == 1 { - require.EqualError(t, ctx.Error, "UDP ports 35466 and 35467 are already assigned to another reader") + require.EqualError(t, ctx.Error, + "UDP ports 35466 and 35467 are already assigned to another reader with the same IP") } }, onSetup: func(ctx *ServerHandlerOnSetupCtx) (*base.Response, *ServerStream, error) { diff --git a/serverstream.go b/serverstream.go index 1a9699aa..08556d15 100644 --- a/serverstream.go +++ b/serverstream.go @@ -145,7 +145,7 @@ func (st *ServerStream) readerAdd( switch transport { case TransportUDP: - // check whether UDP ports are already assigned to another reader + // check whether UDP ports and IP are already assigned to another reader for r := range st.readers { if *r.setuppedTransport == TransportUDP && r.author.ip().Equal(ss.author.ip()) &&