diff --git a/Application/Application.csproj b/Application/Application.csproj
index 8665b750..39f2879d 100644
--- a/Application/Application.csproj
+++ b/Application/Application.csproj
@@ -5,7 +5,7 @@
netcoreapp3.1
false
RaidMax.IW4MAdmin.Application
- 2.3.2.0
+ 2020.0.0.0
RaidMax
Forever None
IW4MAdmin
@@ -21,8 +21,6 @@
IW4MAdmin.Application
false
- 2020.0.0.0
- 2020.0.0.0
diff --git a/Application/IW4MServer.cs b/Application/IW4MServer.cs
index 26e0fecb..75a1331f 100644
--- a/Application/IW4MServer.cs
+++ b/Application/IW4MServer.cs
@@ -952,7 +952,7 @@ namespace IW4MAdmin
RconParser = RconParser ?? Manager.AdditionalRConParsers[0];
EventParser = EventParser ?? Manager.AdditionalEventParsers[0];
- RemoteConnection.SetConfiguration(RconParser.Configuration);
+ RemoteConnection.SetConfiguration(RconParser);
var version = await this.GetMappedDvarValueOrDefaultAsync("version");
Version = version.Value;
diff --git a/Application/RCon/RConConnection.cs b/Application/RCon/RConConnection.cs
index c320800c..2c81bab5 100644
--- a/Application/RCon/RConConnection.cs
+++ b/Application/RCon/RConConnection.cs
@@ -26,6 +26,7 @@ namespace IW4MAdmin.Application.RCon
public IPEndPoint Endpoint { get; private set; }
public string RConPassword { get; private set; }
+ private IRConParser parser;
private IRConParserConfiguration config;
private readonly ILogger _log;
private readonly Encoding _gameEncoding;
@@ -38,9 +39,10 @@ namespace IW4MAdmin.Application.RCon
_log = log;
}
- public void SetConfiguration(IRConParserConfiguration config)
+ public void SetConfiguration(IRConParser parser)
{
- this.config = config;
+ this.parser = parser;
+ config = parser.Configuration;
}
public async Task SendQueryAsync(StaticHelpers.QueryType type, string parameters = "")
@@ -146,7 +148,8 @@ namespace IW4MAdmin.Application.RCon
try
{
- response = await SendPayloadAsync(payload, waitForResponse);
+
+ response = await SendPayloadAsync(payload, waitForResponse, parser.OverrideTimeoutForCommand(parameters));
if ((response.Length == 0 || response[0].Length == 0) && waitForResponse)
{
@@ -286,7 +289,7 @@ namespace IW4MAdmin.Application.RCon
}
}
- private async Task SendPayloadAsync(byte[] payload, bool waitForResponse)
+ private async Task SendPayloadAsync(byte[] payload, bool waitForResponse, TimeSpan overrideTimeout)
{
var connectionState = ActiveQueries[this.Endpoint];
var rconSocket = (Socket)connectionState.SendEventArgs.UserToken;
@@ -337,7 +340,12 @@ namespace IW4MAdmin.Application.RCon
if (receiveDataPending)
{
_log.LogDebug("Waiting to asynchronously receive data on attempt #{connectionAttempts}", connectionState.ConnectionAttempts);
- if (!await Task.Run(() => connectionState.OnReceivedData.Wait(StaticHelpers.SocketTimeout(connectionState.ConnectionAttempts))))
+ if (!await Task.Run(() => connectionState.OnReceivedData.Wait(
+ new[]
+ {
+ StaticHelpers.SocketTimeout(connectionState.ConnectionAttempts),
+ overrideTimeout
+ }.Max())))
{
if (connectionState.ConnectionAttempts > 1) // this reduces some spam for unstable connections
{
diff --git a/Application/RconParsers/BaseRConParser.cs b/Application/RconParsers/BaseRConParser.cs
index 6b8b63a8..ab0aebd7 100644
--- a/Application/RconParsers/BaseRConParser.cs
+++ b/Application/RconParsers/BaseRConParser.cs
@@ -278,5 +278,16 @@ namespace IW4MAdmin.Application.RconParsers
public T GetDefaultDvarValue(string dvarName) => Configuration.DefaultDvarValues.ContainsKey(dvarName) ?
(T)Convert.ChangeType(Configuration.DefaultDvarValues[dvarName], typeof(T)) :
default;
+
+ public TimeSpan OverrideTimeoutForCommand(string command)
+ {
+ if (command.Contains("map_rotate", StringComparison.InvariantCultureIgnoreCase) ||
+ command.StartsWith("map ", StringComparison.InvariantCultureIgnoreCase))
+ {
+ return TimeSpan.FromSeconds(30);
+ }
+
+ return TimeSpan.Zero;
+ }
}
}
diff --git a/Plugins/ScriptPlugins/SampleScriptPluginCommand.js b/Plugins/ScriptPlugins/SampleScriptPluginCommand.js
index 63929aa3..b02f9238 100644
--- a/Plugins/ScriptPlugins/SampleScriptPluginCommand.js
+++ b/Plugins/ScriptPlugins/SampleScriptPluginCommand.js
@@ -27,7 +27,6 @@ let commands = [{
// we want to print out a pong message for the number of times they requested
for (var i = 0; i < times; i++) {
- gameEvent.Origin = undefined;
gameEvent.Origin.Tell(`^${i}pong #${i + 1}^7`);
// don't want to wait if it's the last pong
diff --git a/SharedLibraryCore/Interfaces/IRConConnection.cs b/SharedLibraryCore/Interfaces/IRConConnection.cs
index ec716c3d..2d4a715b 100644
--- a/SharedLibraryCore/Interfaces/IRConConnection.cs
+++ b/SharedLibraryCore/Interfaces/IRConConnection.cs
@@ -17,9 +17,9 @@ namespace SharedLibraryCore.Interfaces
Task SendQueryAsync(StaticHelpers.QueryType type, string parameters = "");
///
- /// sets the rcon parser configuration
+ /// sets the rcon parser
///
- /// parser config
- void SetConfiguration(IRConParserConfiguration config);
+ /// parser
+ void SetConfiguration(IRConParser config);
}
}
diff --git a/SharedLibraryCore/Interfaces/IRConParser.cs b/SharedLibraryCore/Interfaces/IRConParser.cs
index d560a377..8a03ed01 100644
--- a/SharedLibraryCore/Interfaces/IRConParser.cs
+++ b/SharedLibraryCore/Interfaces/IRConParser.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.Threading.Tasks;
using SharedLibraryCore.Database.Models;
using static SharedLibraryCore.Server;
@@ -82,5 +83,12 @@ namespace SharedLibraryCore.Interfaces
/// dvar key name
///
T GetDefaultDvarValue(string dvarName);
+
+ ///
+ /// determines the amount of time to wait for the command to respond
+ ///
+ /// name of command being executed
+ ///
+ TimeSpan OverrideTimeoutForCommand(string command);
}
}
diff --git a/Tests/ApplicationTests/IW4MServerTests.cs b/Tests/ApplicationTests/IW4MServerTests.cs
index 99c269a5..8cdda09a 100644
--- a/Tests/ApplicationTests/IW4MServerTests.cs
+++ b/Tests/ApplicationTests/IW4MServerTests.cs
@@ -15,6 +15,7 @@ using Microsoft.Extensions.Logging;
using SharedLibraryCore;
using SharedLibraryCore.Exceptions;
using SharedLibraryCore.Configuration;
+using ILogger = Microsoft.Extensions.Logging.ILogger;
namespace ApplicationTests
{
diff --git a/WebfrontCore/WebfrontCore.csproj b/WebfrontCore/WebfrontCore.csproj
index db0af4d2..b3e416e1 100644
--- a/WebfrontCore/WebfrontCore.csproj
+++ b/WebfrontCore/WebfrontCore.csproj
@@ -81,13 +81,7 @@
-
-
-
-
-
-
-
+