Skip to content

Commit

Permalink
Force enable TLS 1.1/1.2, fixes checking for updates not working
Browse files Browse the repository at this point in the history
  • Loading branch information
UnknownShadow200 committed Jan 16, 2021
1 parent d14b07b commit 5a0468b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions MCGalaxy/Server/Server.cs
Expand Up @@ -87,6 +87,7 @@ public sealed partial class Server {
shuttingDown = false;
Logger.Log(LogType.SystemActivity, "Starting Server");
ServicePointManager.Expect100Continue = false;
ForceEnableTLS();

CheckFile("MySql.Data.dll");
CheckFile("sqlite3_x32.dll");
Expand Down Expand Up @@ -120,6 +121,12 @@ public sealed partial class Server {
null, TimeSpan.FromMinutes(5));
}

static void ForceEnableTLS() {
// Force enable TLS 1.1/1.2, otherwise checking for updates on Github doesn't work
try { ServicePointManager.SecurityProtocol |= (SecurityProtocolType)0x300; } catch { }
try { ServicePointManager.SecurityProtocol |= (SecurityProtocolType)0xC00; } catch { }
}

static void MoveSqliteDll() {
try {
string dll = IntPtr.Size == 8 ? "sqlite3_x64.dll" : "sqlite3_x32.dll";
Expand Down

0 comments on commit 5a0468b

Please sign in to comment.