Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add end-of-candidate to ICE Agent #311

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 11 additions & 1 deletion agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ type Agent struct {

insecureSkipVerify bool

endOfCandidate bool

proxyDialer proxy.Dialer
}

Expand Down Expand Up @@ -495,7 +497,8 @@ func (a *Agent) connectivityChecks() {
}

// We have been in checking longer then Disconnect+Failed timeout, set the connection to Failed
if time.Since(checkingDuration) > a.disconnectedTimeout+a.failedTimeout {
// ICE Agent not go to failed until it sees a end-of-candidate
if time.Since(checkingDuration) > a.disconnectedTimeout+a.failedTimeout && a.endOfCandidate {
a.updateConnectionState(ConnectionStateFailed)
return
}
Expand Down Expand Up @@ -706,6 +709,12 @@ func (a *Agent) checkKeepalive() {

// AddRemoteCandidate adds a new remote candidate
func (a *Agent) AddRemoteCandidate(c Candidate) error {
// check for end-of-candidate
if c == nil {
a.endOfCandidate = true
return nil
}

// canot check for network yet because it might not be applied
// when mDNS hostame is used.
if c.TCPType() == TCPTypeActive {
Expand Down Expand Up @@ -1192,6 +1201,7 @@ func (a *Agent) Restart(ufrag, pwd string) error {
agent.remoteUfrag = ""
agent.remotePwd = ""
a.gatheringState = GatheringStateNew
a.endOfCandidate = false
a.checklist = make([]*candidatePair, 0)
a.pendingBindingRequests = make([]bindingRequest, 0)
a.setSelectedPair(nil)
Expand Down