doghappy / socket.io-client-csharp

socket.io-client implemention for .NET
MIT License
721 stars 124 forks source link

cancel ConnectAsync when calling Disconnect #307

Closed dationguyen closed 1 year ago

dationguyen commented 1 year ago

Hi Team,

Thanks for doing an amazing job to maintain this library.

I have a question that is how can we stop ConnectAsync() while it's running? In version 3.0.6 we can use Dispose() to trigger the cancellation token and cancel the ConnectAsync() before the timeout but in the recent version 3.0.7, I notice that the Dispose() method no longer triggers the cancellation token which will let the ConnectAsync() retry forever.

Test case:

I would suggest adding back _cts.Cancel() to the Dispose method or on DisconnectAsync() to make sure we don't retry blindly.

doghappy commented 1 year ago

sorry for replying to your issue so late, I am very grateful for your feedback.