|
|
@ -1508,6 +1508,7 @@ func (c *Conn) runDerpReader(ctx context.Context, derpFakeAddr netaddr.IPPort, d
|
|
|
|
peerPresent := map[key.NodePublic]bool{}
|
|
|
|
peerPresent := map[key.NodePublic]bool{}
|
|
|
|
bo := backoff.NewBackoff(fmt.Sprintf("derp-%d", regionID), c.logf, 5*time.Second)
|
|
|
|
bo := backoff.NewBackoff(fmt.Sprintf("derp-%d", regionID), c.logf, 5*time.Second)
|
|
|
|
var lastPacketTime time.Time
|
|
|
|
var lastPacketTime time.Time
|
|
|
|
|
|
|
|
var lastPacketSrc key.NodePublic
|
|
|
|
|
|
|
|
|
|
|
|
for {
|
|
|
|
for {
|
|
|
|
msg, connGen, err := dc.RecvDetail()
|
|
|
|
msg, connGen, err := dc.RecvDetail()
|
|
|
@ -1569,9 +1570,12 @@ func (c *Conn) runDerpReader(ctx context.Context, derpFakeAddr netaddr.IPPort, d
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// If this is a new sender we hadn't seen before, remember it and
|
|
|
|
// If this is a new sender we hadn't seen before, remember it and
|
|
|
|
// register a route for this peer.
|
|
|
|
// register a route for this peer.
|
|
|
|
if _, ok := peerPresent[res.src]; !ok {
|
|
|
|
if res.src != lastPacketSrc { // avoid map lookup w/ high throughput single peer
|
|
|
|
peerPresent[res.src] = true
|
|
|
|
lastPacketSrc = res.src
|
|
|
|
c.addDerpPeerRoute(res.src, regionID, dc)
|
|
|
|
if _, ok := peerPresent[res.src]; !ok {
|
|
|
|
|
|
|
|
peerPresent[res.src] = true
|
|
|
|
|
|
|
|
c.addDerpPeerRoute(res.src, regionID, dc)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case derp.PingMessage:
|
|
|
|
case derp.PingMessage:
|
|
|
|
// Best effort reply to the ping.
|
|
|
|
// Best effort reply to the ping.
|
|
|
|