fix buffer pool

This commit is contained in:
Jason
2019-08-12 15:15:35 +08:00
parent 2254731d3b
commit 757fd11af5
4 changed files with 29 additions and 6 deletions

View File

@@ -81,8 +81,8 @@ func tcpRecvFn(arg unsafe.Pointer, tpcb *C.struct_tcp_pcb, p *C.struct_pbuf, err
if p.tot_len == p.len {
buf = (*[1 << 30]byte)(unsafe.Pointer(p.payload))[:totlen:totlen]
} else {
buf = NewBytes(totlen)
defer FreeBytes(buf)
buf = newBytes(totlen)
defer freeBytes(buf)
C.pbuf_copy_partial(p, unsafe.Pointer(&buf[0]), p.tot_len, 0)
}