mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-16 11:42:43 +08:00
Chore: reset udp timeout after sending each packet (#1260)
This commit is contained in:
parent
6bf115b971
commit
8f09aa0444
|
@ -104,9 +104,14 @@ func handleUDPToRemote(packet C.UDPPacket, pc C.PacketConn, metadata *C.Metadata
|
|||
return errors.New("udp addr invalid")
|
||||
}
|
||||
|
||||
_, err := pc.WriteTo(packet.Data(), addr)
|
||||
if _, err := pc.WriteTo(packet.Data(), addr); err != nil {
|
||||
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) {
|
||||
buf := pool.Get(pool.RelayBufferSize)
|
||||
|
|
Loading…
Reference in New Issue
Block a user