From fe8a560f9e39284bf464de5738c1852ad1821912 Mon Sep 17 00:00:00 2001 From: Alexandr Stelnykovych <stenya@gmail.com> Date: Mon, 24 Feb 2025 17:50:41 +0200 Subject: [PATCH] [fix] Improve sticky domain handling in getStickiedHub function --- spn/crew/sticky.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spn/crew/sticky.go b/spn/crew/sticky.go index c6686c3a..baea2979 100644 --- a/spn/crew/sticky.go +++ b/spn/crew/sticky.go @@ -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 {