MCPcopy Create free account
hub / github.com/pion/ice / TestControlledSelector_TriggeredCheckDuringChecking

Function TestControlledSelector_TriggeredCheckDuringChecking

selection_test.go:426–466  ·  view source on GitHub ↗

TestControlledSelector_TriggeredCheckDuringChecking verifies that a triggered check IS sent when the pair is not yet in Succeeded state (normal ICE checking).

(t *testing.T)

Source from the content-addressed store, hash-verified

424// TestControlledSelector_TriggeredCheckDuringChecking verifies that a triggered
425// check IS sent when the pair is not yet in Succeeded state (normal ICE checking).
426func TestControlledSelector_TriggeredCheckDuringChecking(t *testing.T) {
427 agent := bareAgentForPing()
428 agent.log = logging.NewDefaultLoggerFactory().NewLogger("test")
429 agent.remoteUfrag = selectionTestRemoteUfrag
430 agent.localUfrag = selectionTestLocalUfrag
431 agent.remotePwd = selectionTestPassword
432 agent.localPwd = selectionTestPassword
433 agent.tieBreaker = 1
434 agent.isControlling.Store(false)
435 agent.onConnected = make(chan struct{})
436 agent.setSelector()
437
438 selector, ok := agent.getSelector().(*controlledSelector)
439 require.True(t, ok, "expected controlledSelector")
440
441 local := newPingNoIOCand()
442 local.candidateBase.networkType = NetworkTypeUDP4
443 local.candidateBase.resolvedAddr = &net.UDPAddr{IP: net.ParseIP("192.168.1.1"), Port: 10000}
444
445 remote := newPingNoIOCand()
446 remote.candidateBase.networkType = NetworkTypeUDP4
447 remote.candidateBase.resolvedAddr = &net.UDPAddr{IP: net.ParseIP("192.168.1.2"), Port: 20000}
448
449 pair := agent.addPair(local, remote)
450 // Pair is in Waiting state (not Succeeded), no selected pair — normal ICE checking.
451
452 sentBefore := pair.RequestsSent()
453
454 msg, err := stun.Build(stun.BindingRequest,
455 stun.TransactionID,
456 stun.NewUsername(agent.localUfrag+":"+agent.remoteUfrag),
457 stun.NewShortTermIntegrity(agent.localPwd),
458 stun.Fingerprint,
459 )
460 require.NoError(t, err)
461
462 selector.HandleBindingRequest(msg, local, remote)
463
464 assert.Greater(t, pair.RequestsSent(), sentBefore,
465 "triggered check should be sent during ICE checking phase")
466}
467
468func TestAutomaticRenomination(t *testing.T) { //nolint:maintidx
469 report := test.CheckRoutines(t)

Callers

nothing calls this directly

Calls 9

bareAgentForPingFunction · 0.85
newPingNoIOCandFunction · 0.85
StoreMethod · 0.80
setSelectorMethod · 0.80
getSelectorMethod · 0.80
addPairMethod · 0.80
RequestsSentMethod · 0.80
HandleBindingRequestMethod · 0.65
NewLoggerMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…