fix: UDP packet should not return io.EOF

This commit is contained in:
wwqgtxx
2023-05-15 19:06:58 +08:00
parent 872a28a5eb
commit 1a9104c003
4 changed files with 11 additions and 8 deletions

View File

@ -3,7 +3,6 @@
package packet
import (
"io"
"net"
"strconv"
"syscall"
@ -34,6 +33,7 @@ func (c *enhanceUDPConn) WaitReadFrom() (data []byte, put func(), addr net.Addr,
} else {
put()
put = nil
data = nil
}
if readErr == syscall.EAGAIN {
return false
@ -48,9 +48,10 @@ func (c *enhanceUDPConn) WaitReadFrom() (data []byte, put func(), addr net.Addr,
addr = &net.UDPAddr{IP: ip[:], Port: from.Port, Zone: strconv.FormatInt(int64(from.ZoneId), 10)}
}
}
if readN == 0 {
readErr = io.EOF
}
// udp should not convert readN == 0 to io.EOF
//if readN == 0 {
// readErr = io.EOF
//}
return true
})
if err != nil {