This repository has been archived on 2026-10-31. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Ananta-ps/Ananta.Server/Ananta.Handlers/LoginGate/GateSessionHub.cs
T

30 lines
864 B
C#

using Ananta.SDK.Network;
namespace Ananta.Server.Handlers.LoginGate;
/// <summary>
/// Tracks the authenticated Gate socket. IMasterToClient is routed to ServerMark.Gate
/// in client build 4229938, so server-pushed master RPCs must use this session, not Game.
/// </summary>
internal sealed class GateSessionHub
{
private TcpSession? _current;
private long _lastSeenTicks;
internal TcpSession? Current => Volatile.Read(ref _current);
internal DateTimeOffset? LastSeenUtc
{
get
{
var ticks = Interlocked.Read(ref _lastSeenTicks);
return ticks == 0 ? null : new DateTimeOffset(ticks, TimeSpan.Zero);
}
}
internal void Touch(TcpSession session)
{
Volatile.Write(ref _current, session);
Interlocked.Exchange(ref _lastSeenTicks, DateTimeOffset.UtcNow.Ticks);
}
}