mirror of
https://github.com/pion/webrtc.git
synced 2025-09-27 03:25:58 +08:00
Make onNegotiationNeeded conform to spec
- Removes non-canon logic
This commit is contained in:
@@ -1606,41 +1606,3 @@ func TestPeerConnectionState(t *testing.T) {
|
||||
assert.NoError(t, pc.Close())
|
||||
assert.Equal(t, PeerConnectionStateClosed, pc.ConnectionState())
|
||||
}
|
||||
|
||||
// See https://github.com/pion/webrtc/issues/2774
|
||||
func TestNegotiationNeededAddedAfterOpQueueDone(t *testing.T) {
|
||||
lim := test.TimeOut(time.Second * 30)
|
||||
defer lim.Stop()
|
||||
|
||||
report := test.CheckRoutines(t)
|
||||
defer report()
|
||||
|
||||
pc, err := NewPeerConnection(Configuration{})
|
||||
if err != nil {
|
||||
t.Error(err.Error())
|
||||
}
|
||||
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(1)
|
||||
|
||||
_, err = pc.CreateDataChannel("initial_data_channel", nil)
|
||||
assert.NoError(t, err)
|
||||
|
||||
// after there are no ops left in the queue, a previously faulty version
|
||||
// of negotiationNeededOp would keep the negotiation needed state in
|
||||
// negotiationNeededStateQueue which will cause all subsequent
|
||||
// onNegotiationNeeded calls to never queue again, only if
|
||||
// OnNegotiationNeeded has not been set yet.
|
||||
for !pc.ops.IsEmpty() {
|
||||
time.Sleep(time.Millisecond)
|
||||
}
|
||||
|
||||
pc.OnNegotiationNeeded(wg.Done)
|
||||
|
||||
_, err = pc.CreateDataChannel("another_data_channel", nil)
|
||||
assert.NoError(t, err)
|
||||
|
||||
wg.Wait()
|
||||
|
||||
assert.NoError(t, pc.Close())
|
||||
}
|
||||
|
Reference in New Issue
Block a user