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

Method EnqueueConnectionState

agent_handlers.go:89–122  ·  view source on GitHub ↗
(state ConnectionState)

Source from the content-addressed store, hash-verified

87}
88
89func (h *handlerNotifier) EnqueueConnectionState(state ConnectionState) {
90 h.Lock()
91 defer h.Unlock()
92
93 select {
94 case <-h.done:
95 return
96 default:
97 }
98
99 notify := func() {
100 defer h.notifiers.Done()
101 for {
102 h.Lock()
103 if len(h.connectionStates) == 0 {
104 h.runningConnectionStates = false
105 h.Unlock()
106
107 return
108 }
109 notification := h.connectionStates[0]
110 h.connectionStates = h.connectionStates[1:]
111 h.Unlock()
112 h.connectionStateFunc(notification)
113 }
114 }
115
116 h.connectionStates = append(h.connectionStates, state)
117 if !h.runningConnectionStates {
118 h.runningConnectionStates = true
119 h.notifiers.Add(1)
120 go notify()
121 }
122}
123
124func (h *handlerNotifier) EnqueueCandidate(cand Candidate) {
125 h.Lock()

Calls 1

DoneMethod · 0.45