Compare commits

...

2 Commits
dev ... 2.4.1

Author SHA1 Message Date
  Paulo 15910a1149
misc: Hopefully deploy to MyGet 4 years ago
  Paulo 9ed32c81a6 Bump to 2.4.1 and add deadlock changes 4 years ago
6 changed files with 34 additions and 42 deletions
Unified View
  1. +2
    -2
      Discord.Net.targets
  2. +2
    -3
      azure-pipelines.yml
  3. +1
    -15
      src/Discord.Net.WebSocket/ConnectionManager.cs
  4. +2
    -2
      src/Discord.Net.WebSocket/DiscordSocketApiClient.cs
  5. +11
    -4
      src/Discord.Net.WebSocket/Net/DefaultWebSocketClient.cs
  6. +16
    -16
      src/Discord.Net/Discord.Net.nuspec

+ 2
- 2
Discord.Net.targets View File

@@ -1,7 +1,7 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<VersionPrefix>2.4.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
<VersionPrefix>2.4.1</VersionPrefix>
<VersionSuffix>dev</VersionSuffix>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<Authors>Discord.Net Contributors</Authors> <Authors>Discord.Net Contributors</Authors>
<PackageTags>discord;discordapp</PackageTags> <PackageTags>discord;discordapp</PackageTags>


+ 2
- 3
azure-pipelines.yml View File

@@ -21,7 +21,7 @@ jobs:
- job: Windows_build - job: Windows_build
pool: pool:
vmImage: 'windows-latest' vmImage: 'windows-latest'
condition: ne(variables['Build.SourceBranch'], 'refs/heads/dev')
condition: ne(variables['Build.SourceBranch'], 'refs/heads/2.4.1')
steps: steps:
- template: azure/build.yml - template: azure/build.yml


@@ -32,11 +32,10 @@ jobs:
and ( and (
succeeded(), succeeded(),
or ( or (
eq(variables['Build.SourceBranch'], 'refs/heads/dev'),
eq(variables['Build.SourceBranch'], 'refs/heads/2.4.1'),
eq(variables['buildTag'], True) eq(variables['buildTag'], True)
) )
) )
steps: steps:
- template: azure/build.yml - template: azure/build.yml
- template: azure/deploy.yml - template: azure/deploy.yml
- template: azure/docs.yml

+ 1
- 15
src/Discord.Net.WebSocket/ConnectionManager.cs View File

@@ -75,11 +75,6 @@ namespace Discord
nextReconnectDelay = 1000; //Reset delay nextReconnectDelay = 1000; //Reset delay
await _connectionPromise.Task.ConfigureAwait(false); await _connectionPromise.Task.ConfigureAwait(false);
} }
catch (OperationCanceledException ex)
{
Cancel(); //In case this exception didn't come from another Error call
await DisconnectAsync(ex, !reconnectCancelToken.IsCancellationRequested).ConfigureAwait(false);
}
catch (Exception ex) catch (Exception ex)
{ {
Error(ex); //In case this exception didn't come from another Error call Error(ex); //In case this exception didn't come from another Error call
@@ -143,16 +138,7 @@ namespace Discord
catch (OperationCanceledException) { } catch (OperationCanceledException) { }
}); });


try
{
await _onConnecting().ConfigureAwait(false);
}
catch (TaskCanceledException ex)
{
Exception innerEx = ex.InnerException ?? new OperationCanceledException("Failed to connect.");
Error(innerEx);
throw innerEx;
}
await _onConnecting().ConfigureAwait(false);


await _logger.InfoAsync("Connected").ConfigureAwait(false); await _logger.InfoAsync("Connected").ConfigureAwait(false);
State = ConnectionState.Connected; State = ConnectionState.Connected;


+ 2
- 2
src/Discord.Net.WebSocket/DiscordSocketApiClient.cs View File

@@ -189,9 +189,9 @@ namespace Discord.API
catch { } catch { }


if (ex is GatewayReconnectException) if (ex is GatewayReconnectException)
await WebSocketClient.DisconnectAsync(4000);
await WebSocketClient.DisconnectAsync(4000).ConfigureAwait(false);
else else
await WebSocketClient.DisconnectAsync().ConfigureAwait(false);
await WebSocketClient.DisconnectAsync().ConfigureAwait(false);


ConnectionState = ConnectionState.Disconnected; ConnectionState = ConnectionState.Disconnected;
} }


+ 11
- 4
src/Discord.Net.WebSocket/Net/DefaultWebSocketClient.cs View File

@@ -108,11 +108,11 @@ namespace Discord.Net.WebSockets
} }
private async Task DisconnectInternalAsync(int closeCode = 1000, bool isDisposing = false) private async Task DisconnectInternalAsync(int closeCode = 1000, bool isDisposing = false)
{ {
_isDisconnecting = true;

try { _disconnectTokenSource.Cancel(false); } try { _disconnectTokenSource.Cancel(false); }
catch { } catch { }


_isDisconnecting = true;

if (_client != null) if (_client != null)
{ {
if (!isDisposing) if (!isDisposing)
@@ -166,7 +166,14 @@ namespace Discord.Net.WebSockets


public async Task SendAsync(byte[] data, int index, int count, bool isText) public async Task SendAsync(byte[] data, int index, int count, bool isText)
{ {
await _lock.WaitAsync().ConfigureAwait(false);
try
{
await _lock.WaitAsync(_cancelToken).ConfigureAwait(false);
}
catch (TaskCanceledException)
{
return;
}
try try
{ {
if (_client == null) return; if (_client == null) return;
@@ -201,7 +208,7 @@ namespace Discord.Net.WebSockets
{ {
while (!cancelToken.IsCancellationRequested) while (!cancelToken.IsCancellationRequested)
{ {
WebSocketReceiveResult socketResult = await _client.ReceiveAsync(buffer, CancellationToken.None).ConfigureAwait(false);
WebSocketReceiveResult socketResult = await _client.ReceiveAsync(buffer, cancelToken).ConfigureAwait(false);
byte[] result; byte[] result;
int resultCount; int resultCount;




+ 16
- 16
src/Discord.Net/Discord.Net.nuspec View File

@@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata> <metadata>
<id>Discord.Net</id> <id>Discord.Net</id>
<version>2.4.0$suffix$</version>
<version>2.4.1-dev$suffix$</version>
<title>Discord.Net</title> <title>Discord.Net</title>
<authors>Discord.Net Contributors</authors> <authors>Discord.Net Contributors</authors>
<owners>foxbot</owners> <owners>foxbot</owners>
@@ -14,25 +14,25 @@
<iconUrl>https://github.com/RogueException/Discord.Net/raw/dev/docs/marketing/logo/PackageLogo.png</iconUrl> <iconUrl>https://github.com/RogueException/Discord.Net/raw/dev/docs/marketing/logo/PackageLogo.png</iconUrl>
<dependencies> <dependencies>
<group targetFramework="net461"> <group targetFramework="net461">
<dependency id="Discord.Net.Core" version="2.4.0$suffix$" />
<dependency id="Discord.Net.Rest" version="2.4.0$suffix$" />
<dependency id="Discord.Net.WebSocket" version="2.4.0$suffix$" />
<dependency id="Discord.Net.Commands" version="2.4.0$suffix$" />
<dependency id="Discord.Net.Webhook" version="2.4.0$suffix$" />
<dependency id="Discord.Net.Core" version="2.4.1-dev$suffix$" />
<dependency id="Discord.Net.Rest" version="2.4.1-dev$suffix$" />
<dependency id="Discord.Net.WebSocket" version="2.4.1-dev$suffix$" />
<dependency id="Discord.Net.Commands" version="2.4.1-dev$suffix$" />
<dependency id="Discord.Net.Webhook" version="2.4.1-dev$suffix$" />
</group> </group>
<group targetFramework="netstandard2.0"> <group targetFramework="netstandard2.0">
<dependency id="Discord.Net.Core" version="2.4.0$suffix$" />
<dependency id="Discord.Net.Rest" version="2.4.0$suffix$" />
<dependency id="Discord.Net.WebSocket" version="2.4.0$suffix$" />
<dependency id="Discord.Net.Commands" version="2.4.0$suffix$" />
<dependency id="Discord.Net.Webhook" version="2.4.0$suffix$" />
<dependency id="Discord.Net.Core" version="2.4.1-dev$suffix$" />
<dependency id="Discord.Net.Rest" version="2.4.1-dev$suffix$" />
<dependency id="Discord.Net.WebSocket" version="2.4.1-dev$suffix$" />
<dependency id="Discord.Net.Commands" version="2.4.1-dev$suffix$" />
<dependency id="Discord.Net.Webhook" version="2.4.1-dev$suffix$" />
</group> </group>
<group targetFramework="netstandard2.1"> <group targetFramework="netstandard2.1">
<dependency id="Discord.Net.Core" version="2.4.0$suffix$" />
<dependency id="Discord.Net.Rest" version="2.4.0$suffix$" />
<dependency id="Discord.Net.WebSocket" version="2.4.0$suffix$" />
<dependency id="Discord.Net.Commands" version="2.4.0$suffix$" />
<dependency id="Discord.Net.Webhook" version="2.4.0$suffix$" />
<dependency id="Discord.Net.Core" version="2.4.1-dev$suffix$" />
<dependency id="Discord.Net.Rest" version="2.4.1-dev$suffix$" />
<dependency id="Discord.Net.WebSocket" version="2.4.1-dev$suffix$" />
<dependency id="Discord.Net.Commands" version="2.4.1-dev$suffix$" />
<dependency id="Discord.Net.Webhook" version="2.4.1-dev$suffix$" />
</group> </group>
</dependencies> </dependencies>
</metadata> </metadata>


Loading…
Cancel
Save