mirror of
https://github.com/chylex/Minecraft-Phantom-Panel.git
synced 2025-05-09 23:34:11 +02:00
Fix Server not marking Agent as connected if a keep-alive packet arrives after a temporary packet loss
This commit is contained in:
parent
71a5babb73
commit
7a209d1d71
Server/Phantom.Server.Services/Agents
@ -24,6 +24,11 @@ public sealed record Agent(
|
||||
|
||||
internal Agent(AgentInfo info) : this(info.Guid, info.Name, info.ProtocolVersion, info.BuildVersion, info.MaxInstances, info.MaxMemory, info.AllowedServerPorts, info.AllowedRconPorts) {}
|
||||
|
||||
internal Agent AsOnline(DateTimeOffset lastPing) => this with {
|
||||
LastPing = lastPing,
|
||||
IsOnline = Connection != null
|
||||
};
|
||||
|
||||
internal Agent AsDisconnected() => this with {
|
||||
IsOnline = false
|
||||
};
|
||||
|
@ -101,7 +101,7 @@ public sealed class AgentManager {
|
||||
}
|
||||
|
||||
internal void NotifyAgentIsAlive(Guid agentGuid) {
|
||||
agents.ByGuid.TryReplace(agentGuid, static agent => agent with { LastPing = DateTimeOffset.Now });
|
||||
agents.ByGuid.TryReplace(agentGuid, static agent => agent.AsOnline(DateTimeOffset.Now));
|
||||
}
|
||||
|
||||
internal void SetAgentStats(Guid agentGuid, int runningInstanceCount, RamAllocationUnits runningInstanceMemory) {
|
||||
|
Loading…
Reference in New Issue
Block a user