Update ANCM file monitoring to hopefully avoid unneeded shutdowns #57735
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hoping it fixes issues like #55939 where it looks like a phantom
app_offline.htm
file is seen by ANCM which causes the app to shutdown.There were three specific issues found in the code:
m_detectedAppOffline
wasn't initialized, so it could have any value, if it wastrue
and there was a file notification then we'd trigger an app shutdown due to "detecting" app_offlinecbCompletion
(nowbytesTransferred
) was 0 that app_offline was added to the directory. That's not really a good assumption, so changed it to manually check for app_offlineapp_offline.htm
(e.g.app_o
) would be detected asapp_offline.htm
Also updated what file changes we look for to not include
FILE_NOTIFY_CHANGE_SECURITY
andFILE_NOTIFY_CHANGE_ATTRIBUTES
(ref) to hopefully minimize the likelihood of gettingbytesTransferred == 0
and it just seems like extra work when we aren't interested in those events.