From a4f31629cce6285d71827cff83e18c3b970beede Mon Sep 17 00:00:00 2001 From: yangduo Date: Wed, 7 Aug 2024 10:13:28 +0800 Subject: [PATCH 1/2] fix --- server/gamesapi/service/sapi_forward.go | 1 + 1 file changed, 1 insertion(+) diff --git a/server/gamesapi/service/sapi_forward.go b/server/gamesapi/service/sapi_forward.go index 1f4e8064..5b1d75e9 100644 --- a/server/gamesapi/service/sapi_forward.go +++ b/server/gamesapi/service/sapi_forward.go @@ -119,6 +119,7 @@ func (this *sApiForward) getOrCreate(c *SApiForwardLockCache, accountId string) u = new(SApiForwardLock) u.accountId = accountId u.lock = new(sync.Mutex) + (*c.userHash)[accountId] = u return u } } From f3ddc24fabe828dfe01878a8f02faf6b94c70bf4 Mon Sep 17 00:00:00 2001 From: yangduo Date: Wed, 7 Aug 2024 10:25:32 +0800 Subject: [PATCH 2/2] fix --- server/gamesapi/service/sapi_forward.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/gamesapi/service/sapi_forward.go b/server/gamesapi/service/sapi_forward.go index 5b1d75e9..04b8e8be 100644 --- a/server/gamesapi/service/sapi_forward.go +++ b/server/gamesapi/service/sapi_forward.go @@ -62,7 +62,11 @@ func (this *sApiForward) AcquireLock(accountId string) *SApiForwardLock { func (this *sApiForward) ReleaseLock(l *SApiForwardLock) { l.lock.Unlock() - atomic.AddInt32(&l.lockTimes, -1) + if atomic.AddInt32(&l.lockTimes, -1) < 1 { + crc32 := q5.Crc32(l.accountId) + c := this.userCache[int64(crc32)%int64(len(this.userCache))] + delete(*c.userHash, l.accountId) + } } func (this *sApiForward) IncInvalidSessionTimes() {