setCallback sets the callback for node changes. It also triggers a call for the current node immediately. u.L MUST NOT be held.
(callback func(node *Node))
| 210 | // setCallback sets the callback for node changes. It also triggers a call |
| 211 | // for the current node immediately. u.L MUST NOT be held. |
| 212 | func (u *nodeUpdater) setCallback(callback func(node *Node)) { |
| 213 | u.L.Lock() |
| 214 | defer u.L.Unlock() |
| 215 | u.callback = callback |
| 216 | u.dirty = true |
| 217 | u.sentNode = false |
| 218 | u.Broadcast() |
| 219 | } |
| 220 | |
| 221 | // setBlockEndpoints sets whether we block reporting Node endpoints. u.L MUST NOT |
| 222 | // be held. |