Chore: reset udp timeout after sending each packet (#1260)

This commit is contained in:
gVisor bot 2021-02-26 10:40:55 +08:00
parent 6bf115b971
commit 8f09aa0444

View File

@ -104,8 +104,13 @@ func handleUDPToRemote(packet C.UDPPacket, pc C.PacketConn, metadata *C.Metadata
return errors.New("udp addr invalid") return errors.New("udp addr invalid")
} }
_, err := pc.WriteTo(packet.Data(), addr) if _, err := pc.WriteTo(packet.Data(), addr); err != nil {
return err return err
}
// reset timeout
pc.SetReadDeadline(time.Now().Add(udpTimeout))
return nil
} }
func handleUDPToLocal(packet C.UDPPacket, pc net.PacketConn, key string, fAddr net.Addr) { func handleUDPToLocal(packet C.UDPPacket, pc net.PacketConn, key string, fAddr net.Addr) {