makeratplay / VirtualMeetingMonitor

C# app to monitor UDP traffic to detect a Zoom, WebEx, or MS Teams Meeting then automatically turn on an On Air sign I built.
http://www.makeratplay.com/projects/43
19 stars 7 forks source link

Use the Task-based asynchonous model #4

Open JesHansen opened 3 years ago

JesHansen commented 3 years ago

Fixes #3

In this PR I've switched the asynchronous pattern from the old BeginX/EndX to the more modern Task-based API. The PR consists of a number of small commits so that it's easier to follow along. The PR consists of the following logical steps:

The logic behind how packets are processed is simpler as the async parts are now in a central place, instead of being spread across multiple methods. This allows us to use a simpler mental model of what is happening: Loop to receive packets, handle them as they arrive, shut down when the socket is closed.

I've tested that the app still runs, but async code is tricky; there could easily be something I've overlooked. Do test thouroughly before merging anyhing from the latest commit in this PR. Please let me know if you can spot any behaviour that changes due to this PR. :-)