mirror of
https://github.com/xjasonlyu/tun2socks.git
synced 2025-10-12 20:20:24 +08:00
fix buffer pool
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user