fix: Solves UdpClient "ObjectDisposedException" (#1202)
* Solves "ObjectDisposedException" * Corrected Spelling Error * Fixed Spelling
This commit is contained in:
committed by
Christopher F
parent
2c93363653
commit
ccb16e40c8
@@ -130,6 +130,14 @@ namespace Discord.Net.Udp
|
||||
while (!cancelToken.IsCancellationRequested)
|
||||
{
|
||||
var receiveTask = _udp.ReceiveAsync();
|
||||
|
||||
_ = receiveTask.ContinueWith((receiveResult) =>
|
||||
{
|
||||
//observe the exception as to not receive as unhandled exception
|
||||
_ = receiveResult.Exception;
|
||||
|
||||
}, TaskContinuationOptions.OnlyOnFaulted);
|
||||
|
||||
var task = await Task.WhenAny(closeTask, receiveTask).ConfigureAwait(false);
|
||||
if (task == closeTask)
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user