diff --git a/src/server/distrend.c b/src/server/distrend.c --- a/src/server/distrend.c +++ b/src/server/distrend.c @@ -284,40 +284,34 @@ void change_job_priority(struct distrenj /*@TODO: change frame_finder to job_finder */ int frame_finder(struct distrenjob *head, struct distrenjob **job, struct frameset **frame) { - int your_frame = 0; // your_frame is an integer value that will be given to the client as the frame number to render - short int your_job_type = 0; + int your_frame; // your_frame is an integer value that will be given to the client as the frame number to render + short int your_job_type; unsigned short int found; struct distrenjob *distrenjob_ptr; + your_frame = 0; + your_job_type = 0; found = 0; - - while(!found) - { - /* iterate through jobs from first to last */ - for(distrenjob_ptr = head->next; !found && !distrenjob_ptr; distrenjob_ptr = distrenjob_ptr->next) - { - if(distrenjob_ptr->is_job_done) - distrenjob_ptr->type = your_job_type; - } + /* iterate through jobs from first to last */ + for(distrenjob_ptr = head->next; !found && !distrenjob_ptr; distrenjob_ptr = distrenjob_ptr->next) + { + // while frame hasn't been found, and your_frame is less than the length of the frameset array + for(your_frame; !found && your_frame < distrenjob_ptr->total_frames; your_frame++) + { + if(distrenjob_ptr->frameset[your_frame].status == 0) + { + found = 1; + your_job_type = distrenjob_ptr->type; + distrenjob_ptr->frameset[your_frame].status = 1; + distrenjob_ptr->frameset[your_frame].start_time = clock(); + break; + } + } + } - found = 0; - // check the job type to see if the job is avaliable to be worked on - switch(your_job_type) - { - case 1: // blender - for(your_frame; !found; your_frame++) - { - if(distrenjob_ptr->frameset[your_frame].status == 0) - { - found = 1; - distrenjob_ptr->frameset[your_frame].status = 1; - distrenjob_ptr->frameset[your_frame].start_time = clock(); - break; - } - } - } - } // end of while statement... job must be found or linked list must be ended to get out of here + +// end of while statement... job must be found or linked list must be ended to get out of here if(!found) { fprintf(stderr, "No more jobs to render\n"); diff --git a/src/server/distrenjob.h b/src/server/distrenjob.h --- a/src/server/distrenjob.h +++ b/src/server/distrenjob.h @@ -35,7 +35,6 @@ typedef unsigned int jobnum_t; struct distrenjob { struct distrenjob *next; /*< next will be NULL unless if there is another distrenjob */ short int type; // 1:Blender, 2:something else - short int is_job_done; // so job finder can tell if the job is done no matter what type of job it is char *name; char *submitter; char *email; /*< This should be looked up based on the value of submitter, not stored in this struct */