Use short SRV resolving timeout

By default, lower SRV resolve timeout from 30 seconds to 5 seconds
Should help people facing SRV issues, see #213
Timeout can be set to 30 seconds in settings.
This commit is contained in:
ORelio 2016-11-17 11:18:35 +01:00
parent 1096170d7f
commit 8ec2b2e570
2 changed files with 16 additions and 3 deletions

View file

@ -83,7 +83,7 @@ namespace MinecraftClient.Protocol
{ {
ConsoleIO.WriteLineFormatted(String.Format("§8{0}: {1}", e.GetType().FullName, e.Message)); ConsoleIO.WriteLineFormatted(String.Format("§8{0}: {1}", e.GetType().FullName, e.Message));
} }
}, TimeSpan.FromSeconds(30))) }, TimeSpan.FromSeconds(Settings.ResolveSrvRecordsShortTimeout ? 5 : 30)))
{ {
protocolversion = protocolversionTmp; protocolversion = protocolversionTmp;
forgeInfo = forgeInfoTmp; forgeInfo = forgeInfoTmp;

View file

@ -94,6 +94,7 @@ namespace MinecraftClient
public static CacheType SessionCaching = CacheType.None; public static CacheType SessionCaching = CacheType.None;
public static bool DebugMessages = false; public static bool DebugMessages = false;
public static bool ResolveSrvRecords = true; public static bool ResolveSrvRecords = true;
public static bool ResolveSrvRecordsShortTimeout = true;
//AntiAFK Settings //AntiAFK Settings
public static bool AntiAFK_Enabled = false; public static bool AntiAFK_Enabled = false;
@ -227,7 +228,6 @@ namespace MinecraftClient
case "privatemsgscmdname": PrivateMsgsCmdName = argValue.ToLower().Trim(); break; case "privatemsgscmdname": PrivateMsgsCmdName = argValue.ToLower().Trim(); break;
case "botmessagedelay": botMessageDelay = TimeSpan.FromSeconds(str2int(argValue)); break; case "botmessagedelay": botMessageDelay = TimeSpan.FromSeconds(str2int(argValue)); break;
case "debugmessages": DebugMessages = str2bool(argValue); break; case "debugmessages": DebugMessages = str2bool(argValue); break;
case "resolvesrvrecords": ResolveSrvRecords = str2bool(argValue); break;
case "botowners": case "botowners":
Bots_Owners.Clear(); Bots_Owners.Clear();
@ -308,6 +308,19 @@ namespace MinecraftClient
default: BrandInfo = null; break; default: BrandInfo = null; break;
} }
break; break;
case "resolvesrvrecords":
if (argValue.Trim().ToLower() == "fast")
{
ResolveSrvRecords = true;
ResolveSrvRecordsShortTimeout = true;
}
else
{
ResolveSrvRecords = str2bool(argValue);
ResolveSrvRecordsShortTimeout = false;
}
break;
} }
break; break;
@ -527,7 +540,7 @@ namespace MinecraftClient
+ "showchatlinks=true # Show links embedded in chat messages\r\n" + "showchatlinks=true # Show links embedded in chat messages\r\n"
+ "terrainandmovements=false # Uses more ram, cpu, bandwidth\r\n" + "terrainandmovements=false # Uses more ram, cpu, bandwidth\r\n"
+ "sessioncache=memory # Use 'none', 'memory' or 'disk' (disk is experimental)\r\n" + "sessioncache=memory # Use 'none', 'memory' or 'disk' (disk is experimental)\r\n"
+ "resolvesrvrecords=true # Resolve SRV DNS record (required for joining some servers)\r\n" + "resolvesrvrecords=fast # Use 'false', 'fast' (5s timeout), or 'true'. Required for joining some servers.\r\n"
+ "accountlist=accounts.txt\r\n" + "accountlist=accounts.txt\r\n"
+ "serverlist=servers.txt\r\n" + "serverlist=servers.txt\r\n"
+ "playerheadicon=true\r\n" + "playerheadicon=true\r\n"