Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,29 @@ public void StartMonitoringNetworkChanges()
return;
}

using (ExecutionContext.SuppressFlow())
// RFC: https://tools.ietf.org/html/rfc7838#section-2.2
// When alternative services are used to send a client to the most
// optimal server, a change in network configuration can result in
// cached values becoming suboptimal. Therefore, clients SHOULD remove
// from cache all alternative services that lack the "persist" flag with
// the value "1" when they detect such a change, when information about
// network state is available.
try
{
using (ExecutionContext.SuppressFlow())
{
NetworkChange.NetworkAddressChanged += networkChangedDelegate;
}
}
catch (NetworkInformationException e)
{
NetworkChange.NetworkAddressChanged += networkChangedDelegate;
if (NetEventSource.Log.IsEnabled()) NetEventSource.Error(this, $"Exception when subscribing to NetworkChange.NetworkAddressChanged: {e}");

// We can't monitor network changes, so technically "information
// about network state is not available" and we can just keep
// all Alt-Svc entries until their expiration time.
//
// keep the _networkChangeCleanup field assigned so we don't try again needlessly
}
}

Expand Down