Browse Source

Moved secure channel hresult to a constant

tags/docs-0.9
RogueException 9 years ago
parent
commit
ed20d55438
2 changed files with 7 additions and 3 deletions
  1. +4
    -2
      src/Discord.Net/Net/Rest/BuiltInEngine.cs
  2. +3
    -1
      src/Discord.Net/Net/Rest/SharpRestEngine.cs

+ 4
- 2
src/Discord.Net/Net/Rest/BuiltInEngine.cs View File

@@ -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;
}


+ 3
- 1
src/Discord.Net/Net/Rest/SharpRestEngine.cs View File

@@ -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;
}


Loading…
Cancel
Save