From 375ed774be5f4b6cc74e6417b2c892ba06408dbe Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Mon, 16 May 2022 17:46:28 +0800 Subject: [PATCH] refactor: strategyStickySessions --- adapter/outboundgroup/loadbalance.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/adapter/outboundgroup/loadbalance.go b/adapter/outboundgroup/loadbalance.go index 393a6f31..ccc272b5 100644 --- a/adapter/outboundgroup/loadbalance.go +++ b/adapter/outboundgroup/loadbalance.go @@ -173,7 +173,7 @@ func strategyStickySessions() strategyFn { } session.time = now - var i int + session.idx = 0 var res = proxies[0] for i := 0; i < length; i++ { idx := (session.idx + i) % length @@ -184,10 +184,7 @@ func strategyStickySessions() strategyFn { break } } - if i == length { - session.idx = 0 - res = proxies[0] - } + Sessions[src][dest] = session return res }