Initial commit: Ananta CBT 4229938 private server with all fixes
This commit is contained in:
commit
c84135c357
286 files changed
+2214315
No files matched your search
@@ -0,0 +1,25 @@
|
||||
using Ananta.SDK.Network;
|
||||
|
||||
namespace Ananta.Server.App;
|
||||
|
||||
internal sealed class GameSessionHub
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user