struct pakfire_cpuinfo cpuinfo = {};
struct pakfire_xfer* xfer = NULL;
const char* arch = NULL;
+ const char* id = NULL;
int r;
DEBUG(daemon->ctx, "Connecting...\n");
if (r < 0)
goto ERROR;
+ // Add all running jobs
+ for (unsigned int i = 0; i < MAX_JOBS; i++) {
+ if (!daemon->jobs[i])
+ break;
+
+ // Fetch the job ID
+ id = pakfire_job_get_id(daemon->jobs[i]);
+ if (!id)
+ continue;
+
+ // Add the job ID to the query
+ r = pakfire_xfer_add_query(xfer, "jobs", "%s", id);
+ if (r < 0)
+ goto ERROR;
+ }
+
// Make this a WebSocket connection
r = pakfire_xfer_socket(xfer, pakfire_daemon_connected,
pakfire_daemon_recv, pakfire_daemon_send, pakfire_daemon_close, daemon);
return NULL;
}
+const char* pakfire_job_get_id(struct pakfire_job* self) {
+ return self->id;
+}
+
int pakfire_job_has_id(struct pakfire_job* job, const char* id) {
return pakfire_string_equals(job->id, id);
}
struct pakfire_job* pakfire_job_unref(struct pakfire_job* worker);
// ID
+const char* pakfire_job_get_id(struct pakfire_job* self);
int pakfire_job_has_id(struct pakfire_job* job, const char* id);
// Launch