multiple changes

This commit is contained in:
ffdfgdfg
2019-10-12 22:56:37 +08:00
parent 4c8d7b0738
commit 1f8e441090
14 changed files with 176 additions and 33 deletions

View File

@@ -104,11 +104,7 @@ func (Self *windowBufferPool) Get() (buf []byte) {
}
func (Self *windowBufferPool) Put(x []byte) {
if len(x) == PoolSizeWindow {
Self.pool.Put(x[:PoolSizeWindow]) // make buf to full
} else {
x = nil
}
Self.pool.Put(x[:PoolSizeWindow]) // make buf to full
}
type bufferPool struct {
@@ -146,13 +142,10 @@ func (Self *muxPackagerPool) New() {
}
func (Self *muxPackagerPool) Get() *MuxPackager {
pack := Self.pool.Get().(*MuxPackager)
pack.Content = WindowBuff.Get()
return pack
return Self.pool.Get().(*MuxPackager)
}
func (Self *muxPackagerPool) Put(pack *MuxPackager) {
WindowBuff.Put(pack.Content)
Self.pool.Put(pack)
}