Commit 4920f0ca authored by georgehao's avatar georgehao

feat: fix gettyUDPConn recv err

parent 9dd8f815
......@@ -389,9 +389,9 @@ func (u *gettyUDPConn) recv(p []byte) (int, *net.UDPAddr, error) {
// Optimization: update read deadline only if more than 25%
// of the last read deadline exceeded.
// See https://github.com/golang/go/issues/15133 for details.
currentTime = time.Now()
currentTime := time.Now()
if currentTime.Unix()-u.rLastDeadline > int64(u.rTimeout>>2) {
if err = u.conn.SetReadDeadline(currentTime.Add(u.rTimeout)); err != nil {
if err := u.conn.SetReadDeadline(currentTime.Add(u.rTimeout)); err != nil {
return 0, nil, perrors.WithStack(err)
}
u.rLastDeadline = currentTime.Unix()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment