Refactor bufpool methods

This commit is contained in:
PhatPhuckDave
2024-07-23 14:55:48 +02:00
parent a9827f10ce
commit 2759185dbb
4 changed files with 15 additions and 15 deletions

View File

@@ -15,7 +15,7 @@ func NewBufferPoolManager() *BufferPoolManager {
}
}
func (bpm *BufferPoolManager) GetBuffer(size uint) *[]uint8 {
func (bpm *BufferPoolManager) Get(size uint) *[]uint8 {
bpm.mu.RLock()
pool, exists := bpm.pools[size]
bpm.mu.RUnlock()
@@ -39,7 +39,7 @@ func (bpm *BufferPoolManager) GetBuffer(size uint) *[]uint8 {
return pool.Get().(*[]uint8)
}
func (bpm *BufferPoolManager) PutBuffer(buf *[]uint8) {
func (bpm *BufferPoolManager) Put(buf *[]uint8) {
size := uint(len(*buf))
bpm.mu.RLock()
pool, exists := bpm.pools[size]