fix race condition

This commit is contained in:
ginuerzh
2023-10-19 23:47:47 +08:00
parent f2fd6554ad
commit cc4310106b
29 changed files with 157 additions and 156 deletions

View File

@ -75,8 +75,8 @@ func (c *udpConn) Read(b []byte) (n int, err error) {
buf := bufpool.Get(dlen)
defer bufpool.Put(buf)
_, err = io.ReadFull(c.Conn, *buf)
n = copy(b, *buf)
_, err = io.ReadFull(c.Conn, buf)
n = copy(b, buf)
return
}
@ -169,8 +169,8 @@ func (c *bindUDPConn) Read(b []byte) (n int, err error) {
buf := bufpool.Get(dlen)
defer bufpool.Put(buf)
_, err = io.ReadFull(c.Conn, *buf)
n = copy(b, *buf)
_, err = io.ReadFull(c.Conn, buf)
n = copy(b, buf)
return
}