-
Notifications
You must be signed in to change notification settings - Fork 5.3k
NetworkAddressChange.Unix: use async Socket API to wait for events. #64614
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
Conversation
By replacing the raw handle with a Socket, we ensure only the handle we own gets used. By using the Socket async APIs we no longer need a dedicated Thread to synchronously read the events.
|
Tagging subscribers to this area: @dotnet/ncl Issue DetailsBy replacing the raw handle with a Socket, we ensure only the handle By using the Socket async APIs we no longer need a dedicated Thread
|
...System.Net.NetworkInformation/src/System/Net/NetworkInformation/NetworkAddressChange.Unix.cs
Show resolved
Hide resolved
...System.Net.NetworkInformation/src/System/Net/NetworkInformation/NetworkAddressChange.Unix.cs
Outdated
Show resolved
Hide resolved
...System.Net.NetworkInformation/src/System/Net/NetworkInformation/NetworkAddressChange.Unix.cs
Outdated
Show resolved
Hide resolved
...System.Net.NetworkInformation/src/System/Net/NetworkInformation/NetworkAddressChange.Unix.cs
Outdated
Show resolved
Hide resolved
...System.Net.NetworkInformation/src/System/Net/NetworkInformation/NetworkAddressChange.Unix.cs
Show resolved
Hide resolved
...System.Net.NetworkInformation/src/System/Net/NetworkInformation/NetworkAddressChange.Unix.cs
Show resolved
Hide resolved
...System.Net.NetworkInformation/src/System/Net/NetworkInformation/NetworkAddressChange.Unix.cs
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| s_socket.Dispose(); | ||
| s_socket = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We check under lock if s_socket == null in few places. Is there chance somebody may pick up disposed Socket there?
It seems like it would be better to reset s_socket before disposing to force fresh creation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add some Debug.Assert that verify things are properly guarded.
|
It seems like we lost test to look for runaway work. I don't know if there is any good way how to do that now but it would be nice. It also would be nice to add test that aggressively adds and removes handlers in parallel. It seems like this is where lot if the hard part lives and it may be worth of stressing that code. |
Because we are no longer using blocking APIs the need for a test that verifies we are not blocking a Thread or the ThreadPool is gone. |
By replacing the raw handle with a Socket, we ensure only the handle
we own gets used.
By using the Socket async APIs we no longer need a dedicated Thread
to synchronously read the events.
Fixes #64319, #64441.
cc @ManickaP @wfurt @vdjuric