diff --git a/src/server/distrend.c b/src/server/distrend.c --- a/src/server/distrend.c +++ b/src/server/distrend.c @@ -74,7 +74,6 @@ void status_report_generator(struct dist void distrenjob_remove(struct distrenjob **head, struct distrenjob *bj); struct distrenjob *distrenjob_get(struct distrenjob *head, jobnum_t jobnum); -struct distrenjob *head; /*@TODO:declare struct with no starting data */ /* Global Vars, try to cut down on these */ jobnum_t jobnum = 0; // The next job number to create in the queue @@ -162,11 +161,11 @@ void finish_frame(struct distrenjob *dis /** creates a structure from starting data, then calls another function to actually add that struct to the queue */ -void queue(int type, char *name, char *submitter, char *email, int priority, int start_frame, int end_frame) +void prepare_distrenjob(struct frameset *head, int type, char *name, char *submitter, char *email, int priority, int start_frame, int end_frame) { int counter2; int counter; - + struct distrenjob *distrenjob; distrenjob->type = 1; /*@TODO: add type to blendjob struct*/ @@ -317,7 +316,8 @@ void status_report_generator(struct dist /** Structure Builder: This function creates frame array based on the total number of frames to be rendered, which will then be parsed by function frame_farmer. */ -void add_job_to_queue(struct distrenjob *job) { +/** Structure Builder: This function creates frame array based on the total number of frames to be rendered, which will then be parsed by function frame_farmer. */ +void add_job_to_queue(struct distrenjob *head, struct distrenjob *job) { struct distrenjob *prev_job = head; // create pointer to previous job struct distrenjob *current_job; // create pointer to current_job (which job is being compared to) @@ -328,8 +328,8 @@ void add_job_to_queue(struct distrenjob break; } else if(job->priority < current_job->priority){ // if job's priority is less than current_job's priority, insert job - prev_job->next = job; // keep in mind 1 is the lowest priority - job->next = current_job; + prev_job->next = job; // keep in mind 1 is the highest priority given to jobs, head has a + job->next = current_job; // priority of zero so it will always be before other jobs break; } @@ -556,6 +556,7 @@ int main(int argc, char *argv[]) /* @TODO: Put some arg-grabbing code here */ struct distrenjob *head; + head->priority = 0; // make head have the highest priority int cont; struct distrend_listenset *listenset;