diff --git a/src/Discord.Net/Net/Rest/BuiltInEngine.cs b/src/Discord.Net/Net/Rest/BuiltInEngine.cs index b95fb6499..1f2a201da 100644 --- a/src/Discord.Net/Net/Rest/BuiltInEngine.cs +++ b/src/Discord.Net/Net/Rest/BuiltInEngine.cs @@ -13,7 +13,9 @@ using System.Globalization; namespace Discord.Net.Rest { internal sealed class BuiltInEngine : IRestEngine - { + { + private const int HR_SECURECHANNELFAILED = -2146233079; + private readonly DiscordConfig _config; private readonly HttpClient _client; private readonly string _baseUrl; @@ -81,7 +83,7 @@ namespace Discord.Net.Rest catch (WebException ex) { //The request was aborted: Could not create SSL/TLS secure channel. - if (ex.HResult == -2146233079 && retryCount++ < 5) + if (ex.HResult == HR_SECURECHANNELFAILED && retryCount++ < 5) continue; //Retrying seems to fix this somehow? throw; } diff --git a/src/Discord.Net/Net/Rest/SharpRestEngine.cs b/src/Discord.Net/Net/Rest/SharpRestEngine.cs index 80acdd718..828aa7419 100644 --- a/src/Discord.Net/Net/Rest/SharpRestEngine.cs +++ b/src/Discord.Net/Net/Rest/SharpRestEngine.cs @@ -11,6 +11,8 @@ namespace Discord.Net.Rest { internal sealed class RestSharpEngine : IRestEngine { + private const int HR_SECURECHANNELFAILED = -2146233079; + private readonly DiscordConfig _config; private readonly RestSharp.RestClient _client; @@ -73,7 +75,7 @@ namespace Discord.Net.Rest if (statusCode == 0) //Internal Error { //The request was aborted: Could not create SSL/TLS secure channel. - if (response.ErrorException.HResult == -2146233079 && retryCount++ < 5) + if (response.ErrorException.HResult == HR_SECURECHANNELFAILED && retryCount++ < 5) continue; //Retrying seems to fix this somehow? throw response.ErrorException; }