From 61d19347550bf694e649f3940b5914c5c0ab7381 Mon Sep 17 00:00:00 2001 From: ComputerMaster1st Date: Wed, 15 May 2019 14:48:34 +0100 Subject: [PATCH] Changed to async/await --- src/Discord.Net.WebSocket/ConnectionManager.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Discord.Net.WebSocket/ConnectionManager.cs b/src/Discord.Net.WebSocket/ConnectionManager.cs index c90448735..751ec8314 100644 --- a/src/Discord.Net.WebSocket/ConnectionManager.cs +++ b/src/Discord.Net.WebSocket/ConnectionManager.cs @@ -106,11 +106,13 @@ namespace Discord finally { _stateLock.Release(); } }); } - public virtual Task StopAsync() + + public virtual async Task StopAsync() { Cancel(); - _task?.ConfigureAwait(false).GetAwaiter().GetResult(); - return Task.CompletedTask; + + if (_task != null) + await _task.ConfigureAwait(false); } private async Task ConnectAsync(CancellationTokenSource reconnectCancelToken)