add cancellation token for rcon connection to allow more granular control
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using SharedLibraryCore.RCon;
|
||||
|
||||
namespace SharedLibraryCore.Interfaces
|
||||
@ -14,7 +15,7 @@ namespace SharedLibraryCore.Interfaces
|
||||
/// <param name="type">type of RCon query to perform</param>
|
||||
/// <param name="parameters">optional parameter list</param>
|
||||
/// <returns></returns>
|
||||
Task<string[]> SendQueryAsync(StaticHelpers.QueryType type, string parameters = "");
|
||||
Task<string[]> SendQueryAsync(StaticHelpers.QueryType type, string parameters = "", CancellationToken token = default);
|
||||
|
||||
/// <summary>
|
||||
/// sets the rcon parser
|
||||
@ -22,4 +23,4 @@ namespace SharedLibraryCore.Interfaces
|
||||
/// <param name="config">parser</param>
|
||||
void SetConfiguration(IRConParser config);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using static SharedLibraryCore.Server;
|
||||
|
||||
@ -52,7 +53,7 @@ namespace SharedLibraryCore.Interfaces
|
||||
/// <param name="dvarName">name of DVAR</param>
|
||||
/// <param name="fallbackValue">default value to return if dvar retrieval fails</param>
|
||||
/// <returns></returns>
|
||||
Task<Dvar<T>> GetDvarAsync<T>(IRConConnection connection, string dvarName, T fallbackValue = default);
|
||||
Task<Dvar<T>> GetDvarAsync<T>(IRConConnection connection, string dvarName, T fallbackValue = default, CancellationToken token = default);
|
||||
|
||||
/// <summary>
|
||||
/// set value of DVAR by name
|
||||
@ -61,7 +62,7 @@ namespace SharedLibraryCore.Interfaces
|
||||
/// <param name="dvarName">name of DVAR to set</param>
|
||||
/// <param name="dvarValue">value to set DVAR to</param>
|
||||
/// <returns></returns>
|
||||
Task<bool> SetDvarAsync(IRConConnection connection, string dvarName, object dvarValue);
|
||||
Task<bool> SetDvarAsync(IRConConnection connection, string dvarName, object dvarValue, CancellationToken token = default);
|
||||
|
||||
/// <summary>
|
||||
/// executes a console command on the server
|
||||
@ -69,8 +70,8 @@ namespace SharedLibraryCore.Interfaces
|
||||
/// <param name="connection">RCon connection to use</param>
|
||||
/// <param name="command">console command to execute</param>
|
||||
/// <returns></returns>
|
||||
Task<string[]> ExecuteCommandAsync(IRConConnection connection, string command);
|
||||
|
||||
Task<string[]> ExecuteCommandAsync(IRConConnection connection, string command, CancellationToken token = default);
|
||||
|
||||
/// <summary>
|
||||
/// get the list of connected clients from status response
|
||||
/// </summary>
|
||||
@ -78,7 +79,7 @@ namespace SharedLibraryCore.Interfaces
|
||||
/// <returns>
|
||||
/// <see cref="IStatusResponse" />
|
||||
/// </returns>
|
||||
Task<IStatusResponse> GetStatusAsync(IRConConnection connection);
|
||||
Task<IStatusResponse> GetStatusAsync(IRConConnection connection, CancellationToken token = default);
|
||||
|
||||
/// <summary>
|
||||
/// retrieves the value of given dvar key if it exists in the override dict
|
||||
@ -103,4 +104,4 @@ namespace SharedLibraryCore.Interfaces
|
||||
/// <returns></returns>
|
||||
TimeSpan OverrideTimeoutForCommand(string command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user