Fix VNext choking the ThreadPool
Created by: VelvetThePanda
Summary
Fixes VNext not properly canceling Udp-related tasks.
Details
VNext would previously only cancel the receiver token if incoming voice was enabled, but the receive loop is started regardless of configuration, so an infinite task would get spun up.
Also, in the DspUdpClient, ReceiveAsync would starve threads by failing to cancel BlockingCollection.Take()
when disposing.
Changes proposed
- Cancel BlockingCollection.Take
- Return BlockingCollection.Take directly instead of using Task.Run
- Cancel receiver token in VoiceNextExtension
Notes
Thanks to @alexhorner for pointing this out and helping with testing <3