Skip to content

Commit d4967e8

Browse files
Put a try catch around setting ServicePointManager.SecurityProtcol
If setting those fail, then downloading resources from 123dmwm.com will fail. But that's better than the server not starting at all.
1 parent 3983182 commit d4967e8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

fCraft/System/Server.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ public static void InitLibrary( [NotNull] IEnumerable<string> rawArgs ) {
130130
}
131131

132132
ServicePointManager.Expect100Continue = false;
133+
try {
134+
ServicePointManager.SecurityProtocol = (SecurityProtocolType)(0xc0 | 0x300 | 0xc00 | 0x3000);
135+
} catch( Exception ex ) {
136+
Logger.Log( LogType.Error, "Could not force enable TLS 1.2/1.3: {0}", ex );
137+
}
133138

134139
// try to parse arguments
135140
foreach( string arg in rawArgs ) {
@@ -480,7 +485,6 @@ static void DownloadResources() {
480485

481486
static void DownloadResource(string url, string file) {
482487
ServicePointManager.Expect100Continue = true;
483-
ServicePointManager.SecurityProtocol = (SecurityProtocolType)(0xc0 | 0x300 | 0xc00 | 0x3000);
484488
if (File.Exists(file)) return;
485489

486490
try {

0 commit comments

Comments
 (0)