Merge pull request from safing/fix/spn_stickedHub_logical_issue

[fix] SPN - Improve sticky domain handling in getStickiedHub function
This commit is contained in:
Alexandr Stelnykovych 2025-03-17 16:15:45 +02:00 committed by GitHub
commit 4f3ebc7156
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -71,7 +71,8 @@ func getStickiedHub(conn *network.Connection) (sticksTo *stickyHub) {
// If the IP did not stick and we have a domain, check if that sticks.
if sticksTo == nil && conn.Entity.Domain != "" {
sticksTo, ok := stickyDomains[makeStickyDomainKey(conn)]
var ok bool
sticksTo, ok = stickyDomains[makeStickyDomainKey(conn)]
if ok && !sticksTo.isExpired() {
sticksTo.LastSeen = time.Now()
}
@ -146,6 +147,8 @@ func (t *Tunnel) avoidDestinationHub() {
Avoid: true,
}
log.Warningf("spn/crew: avoiding %s for %s", t.dstPin.Hub, ipKey)
// TODO: Question: Should we avoid the domain as well? (stickyDomains)
}
func cleanStickyHubs(ctx *mgr.WorkerCtx) error {