Automate seed data cleanup on exit#46
Merged
Its-Networking merged 3 commits intoKeyAuth:mainfrom Feb 6, 2025
Merged
Conversation
Implemented std::atexit() to automatically delete seed-related files and registry entries when the program exits, preventing the accumulation of unused seed data over time.
|
The KeyAuth owner has been notified of your pull request. Please wait for him to review it. This could take several days. |
Moved the Sleep interval inside the loop in checkRegistry() to ensure the registry key is checked periodically. Previously, the Sleep call was outside the loop, causing the check to run only once. Now, the function checks the registry at regular intervals and exits if the key is not found.
In the init() function, you create a thread, which runs runChecks this function, in turn, calls checkAtoms, checkFiles, and checkRegistry in sequence. so checkAtoms, checkFiles, and checkRegistry are called from both init() (within runChecks) and license (as individual threads). now you will get Multiple threads running the same functions, you are calling the same functions (checkAtoms, checkFiles, and checkRegistry) twice in parallel once from runChecks (which is called in init()) and once from license(), this leads to multiple threads working on the same task, potentially doing redundant work and introducing unnecessary complexity and overhead. it will consume more system resources (CPU, memory) than necessary. One more thing when you call runChecks from the init() function, it first calls checkAtoms, then checkFiles, and finally checkRegistry. the key point here is that runChecks doesn't return until checkAtoms finishes its work, since checkAtoms has an infinite loop (while(true)) it will never return control to runChecks, you are checking only for GlobalFindAtomA, which mean GetFileAttributesA and RegOpenKeyExA will never be called until you return from checkAtoms. One solution would be to move each of the checkAtoms, checkFiles, and checkRegistry functions into separate threads so they run concurrently, instead of running one after the other in runChecks, and no need to call them again in License() function since they gonna keep working till the program exit I Added a simple mechanism to interrupt the sleep if the user logs in before the 45 seconds have passed, the function waits in a loop, checking every second if the user has logged in, if the user logs in before the 45s timeout, the loop breaks, and the checks begin. if the user hasn’t logged in by the time the 45s pass, it simply proceeds with the checks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Implemented std::atexit() to automatically delete seed-related files and registry entries when the program exits, preventing the accumulation of unused seed data over time.