1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-12-25 19:45:38 -05:00

refactor buffer

This commit is contained in:
Darien Raymond
2016-12-09 12:08:25 +01:00
parent 7a80409e30
commit 055023fdd5
53 changed files with 220 additions and 284 deletions

View File

@@ -84,15 +84,15 @@ func (p *BufferPool) Free(buffer *Buffer) {
}
const (
BufferSize = 8 * 1024
SmallBufferSize = 2 * 1024
Size = 8 * 1024
SizeSmall = 2 * 1024
PoolSizeEnvKey = "v2ray.buffer.size"
)
var (
mediumPool Pool
smallPool = NewSyncPool(2048)
smallPool = NewSyncPool(SizeSmall)
)
func init() {
@@ -106,8 +106,8 @@ func init() {
}
if size > 0 {
totalByteSize := size * 1024 * 1024
mediumPool = NewBufferPool(BufferSize, totalByteSize/BufferSize)
mediumPool = NewBufferPool(Size, totalByteSize/Size)
} else {
mediumPool = NewSyncPool(BufferSize)
mediumPool = NewSyncPool(Size)
}
}