()
| 47 | } |
| 48 | |
| 49 | func (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 | |
| 72 | func (device *Device) GetInboundElementsContainer() *QueueInboundElementsContainer { |
| 73 | c := device.pool.inboundElementsContainer.Get().(*QueueInboundElementsContainer) |
no test coverage detected