Closed shuebner closed 2 years ago
Thanks @shuebner looks fine, please go ahead and add some unit tests.
I rebased onto the latest changes. Note that my first commit just makes the existing code compile, see commit message.
I added two unit tests each for the synchronous and asynchronous SendMessage method call with a cancellation token: one with actual cancellation, one without cancellation.
@spazzarama When will you have time to review the changes?
Will try to get this on the weekend
@spazzarama several weekends later... ;-)
Adds cancellation via Cancellation token.
Cancellation via cancellation token is unified with the existing cancellation via timeout by using some code from Stephen Cleary's AsyncEx. IMHO it improved and simplified the timeout code.
It seems to not break anything according to the tests, has no breaking API changes.
It also seems to not have a significant impact on performance one way or the other:![image](https://user-images.githubusercontent.com/1770684/146780867-30dc7fec-a1c8-4abf-84c1-5ef4abb8ab86.png)
If there are no major complaints, I will try to add some unit tests soon for the functionality.