Chore: reset udp timeout after sending each packet (#1260)
This commit is contained in:
parent
f63c9eb22f
commit
f53686103d
1 changed files with 7 additions and 2 deletions
|
@ -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) {
|
||||||
|
|
Loading…
Reference in a new issue