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

Method IsUnderLoad

polyamide/device/device.go:222–232  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

220}
221
222func (device *Device) IsUnderLoad() bool {
223 // check if currently under load
224 now := time.Now()
225 underLoad := len(device.queue.handshake.c) >= QueueHandshakeSize/8
226 if underLoad {
227 device.rate.underLoadUntil.Store(now.Add(UnderLoadAfterTime).UnixNano())
228 return true
229 }
230 // check if recently under load
231 return device.rate.underLoadUntil.Load() > now.UnixNano()
232}
233
234func (device *Device) SetPrivateKey(sk NoisePrivateKey) error {
235 // lock required resources

Callers 1

RoutineHandshakeMethod · 0.95

Implementers 4

NativeTunpolyamide/tun/tun_linux.go
netTunpolyamide/tun/netstack/tun.go
chTunpolyamide/tun/tuntest/tuntest.go
fakeTUNDeviceSizedpolyamide/device/device_test.go

Calls

no outgoing calls

Tested by

no test coverage detected