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

Method SetEndpointFromPacket

polyamide/device/peer.go:316–331  ·  view source on GitHub ↗
(endpoint conn.Endpoint)

Source from the content-addressed store, hash-verified

314}
315
316func (peer *Peer) SetEndpointFromPacket(endpoint conn.Endpoint) {
317 peer.endpoints.Lock()
318 defer peer.endpoints.Unlock()
319 if peer.endpoints.disableRoaming {
320 return
321 }
322 peer.endpoints.clearSrcOnTx = false
323
324 if peer.endpoints.preferRoaming || len(peer.endpoints.val) == 0 {
325 if len(peer.endpoints.val) == 0 {
326 peer.endpoints.val = append(peer.endpoints.val, endpoint)
327 } else {
328 peer.endpoints.val[0] = endpoint
329 }
330 }
331}
332
333// SetEndpoints configures the endpoints of the peer. The first endpoint will be the default endpoint used for packet routing
334func (peer *Peer) SetEndpoints(endpoints []conn.Endpoint) {

Callers 2

RoutineHandshakeMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected