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

Method PopulatePools

polyamide/device/pools.go:49–70  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

47}
48
49func (device *Device) PopulatePools() {
50 device.pool.inboundElementsContainer = NewWaitPool(PreallocatedBuffersPerPool, func() any {
51 s := make([]*QueueInboundElement, 0, device.BatchSize())
52 return &QueueInboundElementsContainer{elems: s}
53 })
54 device.pool.outboundElementsContainer = NewWaitPool(PreallocatedBuffersPerPool, func() any {
55 s := make([]*QueueOutboundElement, 0, device.BatchSize())
56 return &QueueOutboundElementsContainer{elems: s}
57 })
58 device.pool.messageBuffers = NewWaitPool(PreallocatedBuffersPerPool, func() any {
59 return new([MaxMessageSize]byte)
60 })
61 device.pool.inboundElements = NewWaitPool(PreallocatedBuffersPerPool, func() any {
62 return new(QueueInboundElement)
63 })
64 device.pool.outboundElements = NewWaitPool(PreallocatedBuffersPerPool, func() any {
65 return new(QueueOutboundElement)
66 })
67 device.pool.tcElements = NewWaitPool(PreallocatedBuffersPerPool, func() any {
68 return new(TCElement)
69 })
70}
71
72func (device *Device) GetInboundElementsContainer() *QueueInboundElementsContainer {
73 c := device.pool.inboundElementsContainer.Get().(*QueueInboundElementsContainer)

Callers 1

NewDeviceFunction · 0.80

Implementers 4

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

Calls 2

BatchSizeMethod · 0.95
NewWaitPoolFunction · 0.85

Tested by

no test coverage detected