()
| 294 | } |
| 295 | |
| 296 | func (peer *Peer) Stop() { |
| 297 | peer.state.Lock() |
| 298 | defer peer.state.Unlock() |
| 299 | |
| 300 | if !peer.isRunning.Swap(false) { |
| 301 | return |
| 302 | } |
| 303 | |
| 304 | peer.device.Log.Verbosef("%v - Stopping", peer) |
| 305 | |
| 306 | peer.timersStop() |
| 307 | // Signal that RoutineSequentialSender and RoutineSequentialReceiver should exit. |
| 308 | peer.queue.inbound.c <- nil |
| 309 | peer.queue.outbound.c <- nil |
| 310 | peer.stopping.Wait() |
| 311 | peer.device.queue.encryption.wg.Done() // no more writes to encryption queue from us |
| 312 | |
| 313 | peer.ZeroAndFlushAll() |
| 314 | } |
| 315 | |
| 316 | func (peer *Peer) SetEndpointFromPacket(endpoint conn.Endpoint) { |
| 317 | peer.endpoints.Lock() |
nothing calls this directly
no test coverage detected