revert time out for status preventing server from entering unreachable state

This commit is contained in:
RaidMax 2022-06-08 09:10:31 -05:00
parent cf2a00e5b3
commit 0446fe1ec5
2 changed files with 7 additions and 9 deletions

View File

@ -790,12 +790,10 @@ namespace IW4MAdmin
/// array index 2 = updated clients /// array index 2 = updated clients
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
async Task<List<EFClient>[]> PollPlayersAsync() async Task<List<EFClient>[]> PollPlayersAsync(CancellationToken token)
{ {
var tokenSource = new CancellationTokenSource();
tokenSource.CancelAfter(TimeSpan.FromSeconds(5));
var currentClients = GetClientsAsList(); var currentClients = GetClientsAsList();
var statusResponse = await this.GetStatusAsync(tokenSource.Token); var statusResponse = await this.GetStatusAsync(token);
if (statusResponse is null) if (statusResponse is null)
{ {
@ -918,11 +916,11 @@ namespace IW4MAdmin
private DateTime _lastMessageSent = DateTime.Now; private DateTime _lastMessageSent = DateTime.Now;
private DateTime _lastPlayerCount = DateTime.Now; private DateTime _lastPlayerCount = DateTime.Now;
public override async Task<bool> ProcessUpdatesAsync(CancellationToken cts) public override async Task<bool> ProcessUpdatesAsync(CancellationToken token)
{ {
try try
{ {
if (cts.IsCancellationRequested) if (token.IsCancellationRequested)
{ {
await ShutdownInternal(); await ShutdownInternal();
return true; return true;
@ -936,7 +934,7 @@ namespace IW4MAdmin
return true; return true;
} }
var polledClients = await PollPlayersAsync(); var polledClients = await PollPlayersAsync(token);
if (polledClients is null) if (polledClients is null)
{ {
@ -947,7 +945,7 @@ namespace IW4MAdmin
.Where(client => !client.IsZombieClient /* ignores "fake" zombie clients */)) .Where(client => !client.IsZombieClient /* ignores "fake" zombie clients */))
{ {
disconnectingClient.CurrentServer = this; disconnectingClient.CurrentServer = this;
var e = new GameEvent() var e = new GameEvent
{ {
Type = GameEvent.EventType.PreDisconnect, Type = GameEvent.EventType.PreDisconnect,
Origin = disconnectingClient, Origin = disconnectingClient,

View File

@ -201,7 +201,7 @@ namespace SharedLibraryCore
.ToList(); .ToList();
} }
public virtual Task<bool> ProcessUpdatesAsync(CancellationToken cts) public virtual Task<bool> ProcessUpdatesAsync(CancellationToken token)
{ {
return (Task<bool>)Task.CompletedTask; return (Task<bool>)Task.CompletedTask;
} }