Browse Source

Minor Changes Requested By Foxbot

pull/1199/head
ComputerMaster1st 7 years ago
parent
commit
6617555f0a
2 changed files with 3 additions and 5 deletions
  1. +2
    -2
      src/Discord.Net.WebSocket/ConnectionManager.cs
  2. +1
    -3
      src/Discord.Net.WebSocket/Net/DefaultUdpSocket.cs

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

@@ -103,10 +103,10 @@ namespace Discord
finally { _stateLock.Release(); } finally { _stateLock.Release(); }
}); });
} }
public virtual async Task StopAsync()
public virtual Task StopAsync()
{ {
Cancel(); Cancel();
await Task.CompletedTask;
return Task.CompletedTask;
} }


private async Task ConnectAsync(CancellationTokenSource reconnectCancelToken) private async Task ConnectAsync(CancellationTokenSource reconnectCancelToken)


+ 1
- 3
src/Discord.Net.WebSocket/Net/DefaultUdpSocket.cs View File

@@ -118,14 +118,12 @@ namespace Discord.Net.Udp
{ {
var receiveTask = _udp.ReceiveAsync(); 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 //observe the exception as to not recieve as unhandled exception
_ = recieveResult.Exception; _ = recieveResult.Exception;


}, TaskContinuationOptions.OnlyOnFaulted); }, 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); var task = await Task.WhenAny(closeTask, receiveTask).ConfigureAwait(false);
if (task == closeTask) if (task == closeTask)


Loading…
Cancel
Save