MCPcopy Create free account
hub / github.com/encodeous/nylon / Stop

Method Stop

polyamide/device/peer.go:296–314  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

294}
295
296func (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
316func (peer *Peer) SetEndpointFromPacket(endpoint conn.Endpoint) {
317 peer.endpoints.Lock()

Callers

nothing calls this directly

Calls 4

timersStopMethod · 0.95
ZeroAndFlushAllMethod · 0.95
SwapMethod · 0.80
WaitMethod · 0.45

Tested by

no test coverage detected