(n *Nylon, node state.NodeId, token uint64, ep conn.Endpoint)
| 130 | } |
| 131 | |
| 132 | func handleProbePong(n *Nylon, node state.NodeId, token uint64, ep conn.Endpoint) { |
| 133 | // check if link exists |
| 134 | for _, neigh := range n.RouterState.Neighbours { |
| 135 | for _, dep := range neigh.Eps { |
| 136 | dpLink := dep.AsNylonEndpoint() |
| 137 | ap, err := dpLink.DynEP.Get() |
| 138 | if err == nil && ap == ep.DstIPPort() && neigh.Id == node { |
| 139 | linkHealth, ok := n.PingBuf.GetAndDelete(token) |
| 140 | if ok { |
| 141 | health := linkHealth.Value() |
| 142 | latency := time.Since(health.TimeSent) |
| 143 | // we have a link |
| 144 | if n.DBG_log_probe { |
| 145 | n.Log.Debug("probe back", "peer", node, "ping", latency) |
| 146 | } |
| 147 | dpLink.Renew() |
| 148 | dpLink.UpdatePing(latency) |
| 149 | |
| 150 | // update wireguard endpoint |
| 151 | dpLink.WgEndpoint = ep |
| 152 | |
| 153 | ComputeRoutes(n.RouterState, n) |
| 154 | } |
| 155 | return |
| 156 | } |
| 157 | } |
| 158 | } |
| 159 | n.Log.Warn("probe came back and couldn't find link", "from", ep.DstToString(), "node", node) |
| 160 | } |
| 161 | |
| 162 | func (n *Nylon) probeLinks(active bool) error { |
| 163 | // probe links |
no test coverage detected