kerryjiang / SuperSocket

SuperSocket is a light weight, cross platform and extensible socket server application framework.
Apache License 2.0
3.95k stars 1.15k forks source link

Cancellation token should be respected when calling ConnectAsync #557

Closed kmiterror closed 2 years ago

kmiterror commented 2 years ago

You can pass CancellationToken to IEasyClient.ConnectAsync method. But it's not respected. EasyClient will wait a lot longer than what I specified in CancellationToken. As far as I checked SocketConnector is not doing anything with CancellationToken.

In this PR I passed cancellation token to the Socket which is used internally. Unfortunately, netstandard2.1 doesnt accept CancellationToken as a parameter so I added conditional compilation and implemented special code for netstandard to handle this scenario.

kerryjiang commented 2 years ago

This PR looks nice, thank you!