| @@ -1,7 +1,7 @@ | |||
| <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||
| <PropertyGroup> | |||
| <VersionPrefix>2.4.0</VersionPrefix> | |||
| <VersionSuffix></VersionSuffix> | |||
| <VersionPrefix>2.4.1</VersionPrefix> | |||
| <VersionSuffix>dev</VersionSuffix> | |||
| <LangVersion>latest</LangVersion> | |||
| <Authors>Discord.Net Contributors</Authors> | |||
| <PackageTags>discord;discordapp</PackageTags> | |||
| @@ -75,11 +75,6 @@ namespace Discord | |||
| nextReconnectDelay = 1000; //Reset delay | |||
| 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) | |||
| { | |||
| Error(ex); //In case this exception didn't come from another Error call | |||
| @@ -143,16 +138,7 @@ namespace Discord | |||
| 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); | |||
| State = ConnectionState.Connected; | |||
| @@ -189,9 +189,9 @@ namespace Discord.API | |||
| catch { } | |||
| if (ex is GatewayReconnectException) | |||
| await WebSocketClient.DisconnectAsync(4000); | |||
| await WebSocketClient.DisconnectAsync(4000).ConfigureAwait(false); | |||
| else | |||
| await WebSocketClient.DisconnectAsync().ConfigureAwait(false); | |||
| await WebSocketClient.DisconnectAsync().ConfigureAwait(false); | |||
| ConnectionState = ConnectionState.Disconnected; | |||
| } | |||
| @@ -108,11 +108,11 @@ namespace Discord.Net.WebSockets | |||
| } | |||
| private async Task DisconnectInternalAsync(int closeCode = 1000, bool isDisposing = false) | |||
| { | |||
| _isDisconnecting = true; | |||
| try { _disconnectTokenSource.Cancel(false); } | |||
| catch { } | |||
| _isDisconnecting = true; | |||
| if (_client != null) | |||
| { | |||
| if (!isDisposing) | |||
| @@ -166,7 +166,14 @@ namespace Discord.Net.WebSockets | |||
| 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 | |||
| { | |||
| if (_client == null) return; | |||
| @@ -201,7 +208,7 @@ namespace Discord.Net.WebSockets | |||
| { | |||
| while (!cancelToken.IsCancellationRequested) | |||
| { | |||
| WebSocketReceiveResult socketResult = await _client.ReceiveAsync(buffer, CancellationToken.None).ConfigureAwait(false); | |||
| WebSocketReceiveResult socketResult = await _client.ReceiveAsync(buffer, cancelToken).ConfigureAwait(false); | |||
| byte[] result; | |||
| int resultCount; | |||
| @@ -2,7 +2,7 @@ | |||
| <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> | |||
| <metadata> | |||
| <id>Discord.Net</id> | |||
| <version>2.4.0$suffix$</version> | |||
| <version>2.4.1-dev$suffix$</version> | |||
| <title>Discord.Net</title> | |||
| <authors>Discord.Net Contributors</authors> | |||
| <owners>foxbot</owners> | |||
| @@ -14,25 +14,25 @@ | |||
| <iconUrl>https://github.com/RogueException/Discord.Net/raw/dev/docs/marketing/logo/PackageLogo.png</iconUrl> | |||
| <dependencies> | |||
| <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 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 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> | |||
| </dependencies> | |||
| </metadata> | |||