Skip to content

Commit

Permalink
Changed output attempt delay and added config
Browse files Browse the repository at this point in the history
- Changed attempt delay, increasing it slightly to hopefully account for slower read/write speeds
- Added config for max read attempt count "output_read_attempts"
- Bumped version
  • Loading branch information
Dankrushen committed Sep 15, 2019
1 parent 9cf38a4 commit 3193423
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions MultiAdmin/Config/MultiAdminConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ public class MultiAdminConfig : InheritableConfigRegister
new ConfigEntry<int>("max_players", 20,
"Max Players", "The number of players to display as the maximum for the server (within MultiAdmin, not in-game)");

public ConfigEntry<int> OutputReadAttempts { get; } =
new ConfigEntry<int>("output_read_attempts", 100,
"Output Read Attempts", "The number of times to attempt reading a message from the server before giving up");

public ConfigEntry<bool> RandomInputColors { get; } =
new ConfigEntry<bool>("random_input_colors", false,
"Random Input Colors", "Randomize the new input system's colors every time a message is input");
Expand Down
2 changes: 1 addition & 1 deletion MultiAdmin/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace MultiAdmin
{
public static class Program
{
public const string MaVersion = "3.2.2.1";
public const string MaVersion = "3.2.2.2";
public const string RecommendedMonoVersion = "5.18.0";

private static readonly List<Server> InstantiatedServers = new List<Server>();
Expand Down
6 changes: 3 additions & 3 deletions MultiAdmin/ServerIO/OutputHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void ProcessFile(Server server, string file)
// Lock this object to wait for this event to finish before trying to read another file
lock (this)
{
for (int attempts = 0; attempts < 100; attempts++)
for (int attempts = 0; attempts < server.ServerConfig.OutputReadAttempts.Value; attempts++)
{
try
{
Expand All @@ -107,12 +107,12 @@ public void ProcessFile(Server server, string file)
catch (UnauthorizedAccessException e)
{
Program.LogDebugException(nameof(ProcessFile), e);
Thread.Sleep(5);
Thread.Sleep(8);
}
catch (Exception e)
{
Program.LogDebugException(nameof(ProcessFile), e);
Thread.Sleep(2);
Thread.Sleep(5);
}
}
}
Expand Down

0 comments on commit 3193423

Please sign in to comment.