Browse Source

webrtc: fix race in TestRemoveConnByUfrag (#2620)

pull/2621/head
Sukun 1 year ago
committed by GitHub
parent
commit
2c36d31678
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      p2p/transport/webrtc/udpmux/mux_test.go

12
p2p/transport/webrtc/udpmux/mux_test.go

@ -151,7 +151,9 @@ func TestRemoveConnByUfrag(t *testing.T) {
for i := 0; i < 10; i++ {
mc1, err := m.GetConn(ufrag, conns[i].LocalAddr())
require.NoError(t, err)
require.Equal(t, mc1, mc)
if mc1 != mc {
t.Fatalf("expected the two muxed connections to be same")
}
}
// Now remove the ufrag
@ -167,13 +169,17 @@ func TestRemoveConnByUfrag(t *testing.T) {
for i := 0; i < 10; i++ {
mc1, err := m.GetConn(ufrag, conns[i].LocalAddr())
require.NoError(t, err)
require.Equal(t, mc1, mc)
if mc1 != mc {
t.Fatalf("expected the two muxed connections to be same")
}
}
// Should be different even if the address is the same
mc1, err := m.GetConn("a", conns[0].LocalAddr())
require.NoError(t, err)
require.NotEqual(t, mc1, mc)
if mc1 == mc {
t.Fatalf("expected the two connections to be different")
}
}
func TestMuxedConnection(t *testing.T) {

Loading…
Cancel
Save