mirror of
https://github.com/KusakabeShi/EtherGuard-VPN.git
synced 2024-11-22 07:13:09 +01:00
Fix local timediff
This commit is contained in:
parent
17fe0cdae3
commit
7ef762b6b0
@ -309,9 +309,12 @@ func (device *Device) server_process_Pong(peer *Peer, content mtypes.PongMsg) er
|
||||
|
||||
func (device *Device) process_ping(peer *Peer, content mtypes.PingMsg) error {
|
||||
Timediff := device.graph.GetCurrentTime().Sub(content.Time).Seconds()
|
||||
NewTimediff := peer.SingleWayLatency.Load().(float64)
|
||||
DR := NewTimediff * device.EdgeConfig.DynamicRoute.P2P.GraphRecalculateSetting.DampingResistance
|
||||
NewTimediff = NewTimediff*DR + Timediff*(1-DR)
|
||||
OldTimediff := peer.SingleWayLatency.Load().(float64)
|
||||
NewTimediff := Timediff
|
||||
if OldTimediff <= mtypes.Infinity {
|
||||
DR := device.EdgeConfig.DynamicRoute.P2P.GraphRecalculateSetting.DampingResistance
|
||||
NewTimediff = OldTimediff*DR + Timediff*(1-DR)
|
||||
}
|
||||
peer.SingleWayLatency.Store(NewTimediff)
|
||||
|
||||
PongMSG := mtypes.PongMsg{
|
||||
|
Loading…
Reference in New Issue
Block a user