tweak rcon timeout for script calls

This commit is contained in:
RaidMax 2022-03-01 12:46:01 -06:00
parent ec0f59cdb1
commit 241aa0a5f6
2 changed files with 17 additions and 6 deletions

View File

@ -63,10 +63,21 @@ namespace Integrations.Cod
finally
{
if (ActiveQueries[Endpoint].OnComplete.CurrentCount == 0)
var state = ActiveQueries[Endpoint];
if (state.OnComplete.CurrentCount == 0)
{
ActiveQueries[Endpoint].OnComplete.Release(1);
ActiveQueries[Endpoint].ConnectionAttempts = 0;
state.OnComplete.Release(1);
state.ConnectionAttempts = 0;
}
if (state.OnReceivedData.CurrentCount == 0)
{
state.OnReceivedData.Release(1);
}
if (state.OnSentData.CurrentCount == 0)
{
state.OnSentData.Release(1);
}
}
}

View File

@ -391,7 +391,7 @@ namespace SharedLibraryCore
public string[] ExecuteServerCommand(string command)
{
var tokenSource = new CancellationTokenSource();
tokenSource.CancelAfter(TimeSpan.FromSeconds(1));
tokenSource.CancelAfter(TimeSpan.FromSeconds(5));
try
{
@ -406,7 +406,7 @@ namespace SharedLibraryCore
public string GetServerDvar(string dvarName)
{
var tokenSource = new CancellationTokenSource();
tokenSource.CancelAfter(TimeSpan.FromSeconds(1));
tokenSource.CancelAfter(TimeSpan.FromSeconds(5));
try
{
return this.GetDvarAsync<string>(dvarName, token: tokenSource.Token).GetAwaiter().GetResult().Value;
@ -420,7 +420,7 @@ namespace SharedLibraryCore
public bool SetServerDvar(string dvarName, string dvarValue)
{
var tokenSource = new CancellationTokenSource();
tokenSource.CancelAfter(TimeSpan.FromSeconds(1));
tokenSource.CancelAfter(TimeSpan.FromSeconds(5));
try
{
this.SetDvarAsync(dvarName, dvarValue, tokenSource.Token).GetAwaiter().GetResult();