downLocked attempts to bring the device down. The caller must hold device.state.mu and is responsible for updating device.state.state.
()
| 198 | // downLocked attempts to bring the device down. |
| 199 | // The caller must hold device.state.mu and is responsible for updating device.state.state. |
| 200 | func (device *Device) downLocked() error { |
| 201 | err := device.BindClose() |
| 202 | if err != nil { |
| 203 | device.Log.Errorf("Bind close failed: %v", err) |
| 204 | } |
| 205 | |
| 206 | device.peers.RLock() |
| 207 | for _, peer := range device.peers.keyMap { |
| 208 | peer.Stop() |
| 209 | } |
| 210 | device.peers.RUnlock() |
| 211 | return err |
| 212 | } |
| 213 | |
| 214 | func (device *Device) Up() error { |
| 215 | return device.changeState(deviceStateUp) |
no test coverage detected