From 6617555f0a28f5ddee845b15b3e6c678080144dc Mon Sep 17 00:00:00 2001 From: ComputerMaster1st Date: Tue, 24 Jul 2018 14:30:19 +0100 Subject: [PATCH] Minor Changes Requested By Foxbot --- src/Discord.Net.WebSocket/ConnectionManager.cs | 4 ++-- src/Discord.Net.WebSocket/Net/DefaultUdpSocket.cs | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Discord.Net.WebSocket/ConnectionManager.cs b/src/Discord.Net.WebSocket/ConnectionManager.cs index 53feae1b4..65adc1583 100644 --- a/src/Discord.Net.WebSocket/ConnectionManager.cs +++ b/src/Discord.Net.WebSocket/ConnectionManager.cs @@ -103,10 +103,10 @@ namespace Discord finally { _stateLock.Release(); } }); } - public virtual async Task StopAsync() + public virtual Task StopAsync() { Cancel(); - await Task.CompletedTask; + return Task.CompletedTask; } private async Task ConnectAsync(CancellationTokenSource reconnectCancelToken) diff --git a/src/Discord.Net.WebSocket/Net/DefaultUdpSocket.cs b/src/Discord.Net.WebSocket/Net/DefaultUdpSocket.cs index e92b31b8d..c8496807e 100644 --- a/src/Discord.Net.WebSocket/Net/DefaultUdpSocket.cs +++ b/src/Discord.Net.WebSocket/Net/DefaultUdpSocket.cs @@ -118,14 +118,12 @@ namespace Discord.Net.Udp { var receiveTask = _udp.ReceiveAsync(); -#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed - receiveTask.ContinueWith((recieveResult) => + _ = receiveTask.ContinueWith((recieveResult) => { //observe the exception as to not recieve as unhandled exception _ = recieveResult.Exception; }, TaskContinuationOptions.OnlyOnFaulted); -#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed var task = await Task.WhenAny(closeTask, receiveTask).ConfigureAwait(false); if (task == closeTask)