This commit is contained in:
Oliver Booth 2024-02-25 14:12:58 +00:00
parent e21dfd17ff
commit 9c938bc730
Signed by: oliverbooth
GPG Key ID: E60B570D1B7557B5

View File

@ -161,13 +161,19 @@ internal sealed class SessionService : BackgroundService, ISessionService
Span<byte> sessionAddressBytes = stackalloc byte[16]; Span<byte> sessionAddressBytes = stackalloc byte[16];
if (!remoteIpAddress.TryWriteBytes(remoteAddressBytes, out _) || if (!remoteIpAddress.TryWriteBytes(remoteAddressBytes, out _) ||
!session.IpAddress.TryWriteBytes(sessionAddressBytes, out _)) !session.IpAddress.TryWriteBytes(sessionAddressBytes, out _))
{
return false; return false;
}
if (!remoteAddressBytes.SequenceEqual(sessionAddressBytes)) if (!remoteAddressBytes.SequenceEqual(sessionAddressBytes))
{
return false; return false;
}
if (_userService.TryGetUser(session.UserId, out _)) if (_userService.TryGetUser(session.UserId, out _))
{
return false; return false;
}
return true; return true;
} }