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

Method EnqueueCandidate

agent_handlers.go:124–157  ·  view source on GitHub ↗
(cand Candidate)

Source from the content-addressed store, hash-verified

122}
123
124func (h *handlerNotifier) EnqueueCandidate(cand Candidate) {
125 h.Lock()
126 defer h.Unlock()
127
128 select {
129 case <-h.done:
130 return
131 default:
132 }
133
134 notify := func() {
135 defer h.notifiers.Done()
136 for {
137 h.Lock()
138 if len(h.candidates) == 0 {
139 h.runningCandidates = false
140 h.Unlock()
141
142 return
143 }
144 notification := h.candidates[0]
145 h.candidates = h.candidates[1:]
146 h.Unlock()
147 h.candidateFunc(notification)
148 }
149 }
150
151 h.candidates = append(h.candidates, cand)
152 if !h.runningCandidates {
153 h.runningCandidates = true
154 h.notifiers.Add(1)
155 go notify()
156 }
157}
158
159func (h *handlerNotifier) EnqueueSelectedCandidatePair(pair *CandidatePair) {
160 h.Lock()

Calls 1

DoneMethod · 0.45