Moved secure channel hresult to a constant
This commit is contained in:
@@ -13,7 +13,9 @@ using System.Globalization;
|
|||||||
namespace Discord.Net.Rest
|
namespace Discord.Net.Rest
|
||||||
{
|
{
|
||||||
internal sealed class BuiltInEngine : IRestEngine
|
internal sealed class BuiltInEngine : IRestEngine
|
||||||
{
|
{
|
||||||
|
private const int HR_SECURECHANNELFAILED = -2146233079;
|
||||||
|
|
||||||
private readonly DiscordConfig _config;
|
private readonly DiscordConfig _config;
|
||||||
private readonly HttpClient _client;
|
private readonly HttpClient _client;
|
||||||
private readonly string _baseUrl;
|
private readonly string _baseUrl;
|
||||||
@@ -81,7 +83,7 @@ namespace Discord.Net.Rest
|
|||||||
catch (WebException ex)
|
catch (WebException ex)
|
||||||
{
|
{
|
||||||
//The request was aborted: Could not create SSL/TLS secure channel.
|
//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?
|
continue; //Retrying seems to fix this somehow?
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ namespace Discord.Net.Rest
|
|||||||
{
|
{
|
||||||
internal sealed class RestSharpEngine : IRestEngine
|
internal sealed class RestSharpEngine : IRestEngine
|
||||||
{
|
{
|
||||||
|
private const int HR_SECURECHANNELFAILED = -2146233079;
|
||||||
|
|
||||||
private readonly DiscordConfig _config;
|
private readonly DiscordConfig _config;
|
||||||
private readonly RestSharp.RestClient _client;
|
private readonly RestSharp.RestClient _client;
|
||||||
|
|
||||||
@@ -73,7 +75,7 @@ namespace Discord.Net.Rest
|
|||||||
if (statusCode == 0) //Internal Error
|
if (statusCode == 0) //Internal Error
|
||||||
{
|
{
|
||||||
//The request was aborted: Could not create SSL/TLS secure channel.
|
//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?
|
continue; //Retrying seems to fix this somehow?
|
||||||
throw response.ErrorException;
|
throw response.ErrorException;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user