Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle exceptions during receive and dispose timer #24

Open
wants to merge 3 commits into
base: netcore
Choose a base branch
from

Conversation

Nuklon
Copy link

@Nuklon Nuklon commented Feb 28, 2024

Exceptions weren't handled properly, causing them to appear in UnobservedTaskException.
Also the Timer created during MainTask wasn't disposed. I've split this up in two methods to greatly simplify the logic.

@jpmikkers
Copy link
Owner

Hi, I agree the OperationCanceledException should be handled of course (I've been working on asyncifying TFTPServer and ran into the same issue). But there's a good reason to have just one thread/maintask: this ensures I don't need locking for state updates of the dhcp server. I'll have a go at merging the fixes I applied to TFTPServer into DHCPServer, that should do the trick.

Address feedback.
@Nuklon
Copy link
Author

Nuklon commented Feb 28, 2024

Ah, yes, I see. The problem is that with WhenAny one task remains running in the background and never catched properly. I think it makes sense to add some trivial synchronization here, I've added another commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants