Files
RobustToolbox/Robust.Shared/Player/CommonSession.cs
Pieter-Jan Briers dc1464b462 High-bandwidth transfer system (#6373)
* WebSocket-based data transfer system

* Move resource downloads/uploads to the new transfer system

Should drastically increase the permitted practical size

* Transfer impl for Lidgren

* Async impl for receive stream

* Use unbounded channel for Lidgren

* Add metrics

* More comments

* Add serverside stream limit to avoid being a DoS vector

* Fix tests

* Oops forgot to actually implement sequence channels in NetMessage

* Doc comment for NetMessage.SequenceChannel

* Release notes
2026-01-19 20:44:44 +01:00

92 lines
1.9 KiB
C#

using System;
using System.Collections.Generic;
using Robust.Shared.Enums;
using Robust.Shared.GameObjects;
using Robust.Shared.GameStates;
using Robust.Shared.Network;
using Robust.Shared.ViewVariables;
namespace Robust.Shared.Player;
internal sealed class CommonSession : ICommonSessionInternal
{
[ViewVariables]
public EntityUid? AttachedEntity { get; set; }
[ViewVariables]
public NetUserId UserId { get; }
[ViewVariables]
public string Name { get; set; } = "<Unknown>";
[ViewVariables]
public short Ping
{
get => Channel?.Ping ?? _ping;
set => _ping = value;
}
private short _ping;
[ViewVariables]
public DateTime ConnectedTime { get; set; }
[ViewVariables]
public SessionState State { get; } = new();
[ViewVariables]
public SessionStatus Status { get; set; } = SessionStatus.Connecting;
[ViewVariables]
public SessionData Data { get; }
public bool ClientSide { get; set; }
[ViewVariables]
public INetChannel Channel { get; set; } = default!;
[ViewVariables]
public HashSet<EntityUid> ViewSubscriptions { get; } = new();
[ViewVariables]
public LoginType AuthType => Channel?.AuthType ?? default;
[ViewVariables]
public bool InitialPlayerListReqDone;
[ViewVariables]
public bool InitialResourcesDone;
public override string ToString() => Name;
public CommonSession(NetUserId user, string name, SessionData data)
{
UserId = user;
Name = name;
Data = data;
}
public void SetStatus(SessionStatus status)
{
Status = status;
}
public void SetAttachedEntity(EntityUid? uid)
{
AttachedEntity = uid;
}
public void SetPing(short ping)
{
Ping = ping;
}
public void SetName(string name)
{
Name = name;
}
public void SetChannel(INetChannel channel)
{
Channel = channel;
}
}