fix: udp hop returning bogus close errors

This commit is contained in:
Toby 2023-09-01 02:29:05 -07:00
parent 6bcb00a0cc
commit ee70476030

View file

@ -83,7 +83,13 @@ func (u *udpHopPacketConn) recvLoop(conn net.PacketConn) {
n, addr, err := conn.ReadFrom(buf)
if err != nil {
u.bufPool.Put(buf)
u.recvQueue <- &udpPacket{nil, 0, nil, err}
var netErr net.Error
if errors.As(err, &netErr) && netErr.Timeout() {
// Only pass through timeout errors here, not permanent errors
// like connection closed. Connection close is normal as we close
// the old connection to exit this loop every time we hop.
u.recvQueue <- &udpPacket{nil, 0, nil, netErr}
}
return
}
select {