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

Better check for PoGo running #19

Open
VampireSilence opened this issue Apr 9, 2023 · 2 comments
Open

Better check for PoGo running #19

VampireSilence opened this issue Apr 9, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@VampireSilence
Copy link

Sometimes PoGo stops working even though it's opened and the frontmost app, so a better approach would be to check if PoGo is actually doing something. Those functions check the last log time of GC and then checks if it's more than 5 minutes in the past. We can further tweak that time frame in the future.

#include <asl.h>
#include <time.h>

int pogo_work_state(time_t log_time)
{
    time_t current_time = time(NULL);
    return (difftime(current_time, log_time) > 300);
}

time_t get_last_log_time()
{
    aslclient client = asl_open(NULL, "com.gocheats.jb", 0);
    aslmsg query = asl_new(ASL_TYPE_QUERY);
    asl_set_query(query, ASL_KEY_SENDER, "com.gocheats.jb", ASL_QUERY_OP_EQUAL);
    aslresponse response = asl_search(client, query);
    aslmsg msg;

    time_t last_time = 0;
    while ((msg = aslresponse_next(response)) != NULL)
    {
        const char *time_str = asl_get(msg, ASL_KEY_TIME);
        time_t time_val = (time_t)strtoll(time_str, NULL, 10);
        if (time_val > last_time)
        {
            last_time = time_val;
        }
    }

    aslresponse_free(response);
    asl_free(query);
    asl_close(client);

    return last_time;
}
@clburlison
Copy link
Owner

Was hoping we wouldn't have to do this. Now that I got the stupid version checking & downloads working as intended this will be next. Your code looks correct so hopefully I'll only need to do a little testing.

@clburlison clburlison added the bug Something isn't working label Apr 9, 2023
@clburlison
Copy link
Owner

Still want to investigate this but one core issue I have seen is the launchDaemon stopping with a non-zero exit code. Pretty sure calling the killall binary is one of the issues since kernbypass blocks that process.

Will have a new update out in a few days that hopefully improves the monitoring aspect. It's been more stable on my four test devices the last 24hrs.

If this is still an issue after that update I'll look into monitoring the log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants