mirror of
https://github.com/netbirdio/ice.git
synced 2026-05-22 17:10:58 -07:00
Accept nil Candidate in AddRemoteCandidate
Allow a user to pass a nil Candidate. We perform no actions off of this currently. Until browsers implement end-of-candidates consistently it isn't something we can do. Relates to pion/webrtc#1212 and #271
This commit is contained in:
@@ -706,7 +706,11 @@ func (a *Agent) checkKeepalive() {
|
||||
|
||||
// AddRemoteCandidate adds a new remote candidate
|
||||
func (a *Agent) AddRemoteCandidate(c Candidate) error {
|
||||
// canot check for network yet because it might not be applied
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
// cannot check for network yet because it might not be applied
|
||||
// when mDNS hostame is used.
|
||||
if c.TCPType() == TCPTypeActive {
|
||||
// TCP Candidates with tcptype active will probe server passive ones, so
|
||||
|
||||
@@ -1686,3 +1686,11 @@ func TestLiteLifecycle(t *testing.T) {
|
||||
<-bFailed
|
||||
assert.NoError(t, bAgent.Close())
|
||||
}
|
||||
|
||||
func TestNilCandidate(t *testing.T) {
|
||||
a, err := NewAgent(&AgentConfig{})
|
||||
assert.NoError(t, err)
|
||||
|
||||
assert.NoError(t, a.AddRemoteCandidate(nil))
|
||||
assert.NoError(t, a.Close())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user