fix : playerID == hashkey 통일 / long => int로 변경
This commit is contained in:
@@ -3,20 +3,20 @@ namespace MMOserver.Utils;
|
||||
public class UuidGenerator
|
||||
{
|
||||
// 0 ~ 1000 은 더미 클라이언트 예약 범위
|
||||
private const long DUMMY_RANGE_MAX = 1000;
|
||||
private const int DUMMY_RANGE_MAX = 1000;
|
||||
|
||||
private readonly object idLock = new();
|
||||
private readonly HashSet<long> usedIds = new();
|
||||
private readonly HashSet<int> usedIds = new();
|
||||
|
||||
// 고유 랜덤 long ID 발급 (1001번 이상, 충돌 시 재생성)
|
||||
public long Create()
|
||||
// 고유 랜덤 int ID 발급 (1001번 이상, 충돌 시 재생성)
|
||||
public int Create()
|
||||
{
|
||||
lock (idLock)
|
||||
{
|
||||
long id;
|
||||
int id;
|
||||
do
|
||||
{
|
||||
id = Random.Shared.NextInt64(DUMMY_RANGE_MAX + 1, long.MaxValue);
|
||||
id = Random.Shared.Next(DUMMY_RANGE_MAX + 1, int.MaxValue);
|
||||
} while (usedIds.Contains(id));
|
||||
|
||||
usedIds.Add(id);
|
||||
@@ -25,7 +25,7 @@ public class UuidGenerator
|
||||
}
|
||||
|
||||
// 로그아웃 / 세션 만료 시 ID 반납
|
||||
public bool Release(long id)
|
||||
public bool Release(int id)
|
||||
{
|
||||
lock (idLock)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user