diff --git a/src/server/distrend.c b/src/server/distrend.c --- a/src/server/distrend.c +++ b/src/server/distrend.c @@ -181,12 +181,15 @@ void mortition(struct distrenjob *head, } } - if(isJobDone) + if(isJobDone) // if all frames were accounted for { distrenjob_remove(head, job); distrenjob_free(&job); general_info.jobs_in_queue--; } + else{ + job->prev_frame_index = 0; // if the job isn't done, have frame_finder() start from the first frame, allowing it to see the frames that are now unassigned + } } /** @@ -298,7 +301,7 @@ int find_jobframe(struct distrenjob *hea found = 0; /* iterate through jobs from first to last */ for(distrenjob_ptr = head->next; (!found && !distrenjob_ptr) && !distrenjob_ptr->hibernate; distrenjob_ptr = distrenjob_ptr->next) - for(frame_counter = 0; !found && frame_counter < distrenjob_ptr->total_frames; frame_counter ++) + for(frame_counter = distrenjob_ptr->prev_frame_index; !found && frame_counter < distrenjob_ptr->total_frames; frame_counter ++) if(distrenjob_ptr->frameset[frame_counter].status == FRAMESETSTATUS_UNASSIGNED) { found = 1; diff --git a/src/server/distrenjob.h b/src/server/distrenjob.h --- a/src/server/distrenjob.h +++ b/src/server/distrenjob.h @@ -45,6 +45,7 @@ struct distrenjob { int total_frames; // how many frames are in the animation for stats/etc (unassigned frames) int watchdog_forgiveness; // how many seconds till the frame is re-assigned (if client computer crashes etc); short int hibernate; + int prev_frame_index; // the position in the array of the last frame that was assigned time_t total_render_time; // total seconds of time spent on all the completed frames char *output_format; /*< currently is the file extention of the request output format. @todo make this mime-type based/not a string */ struct frameset *frameset;