diff --git a/src/server/distrend.c b/src/server/distrend.c --- a/src/server/distrend.c +++ b/src/server/distrend.c @@ -92,11 +92,11 @@ struct distrend_config */ struct general_info { - short int jobs_in_queue; // - unsigned short int free_clients; - unsigned short int rendering_clients;// - unsigned short int total_finished_jobs; // - unsigned int total_frames_rendered; // + short int jobs_in_queue; // + unsigned short int free_clients; + unsigned short int rendering_clients;// + unsigned short int total_finished_jobs; // + unsigned int total_frames_rendered; // } general_info; @@ -131,14 +131,14 @@ int distrend_do() */ void distrend_accept() { - + } /** - Frees the action + Frees the action */ void distrend_action_free() { - + } /** Start listening @@ -148,7 +148,7 @@ void distrend_listen() } /** - Stop listening + Stop listening */ void distrend_unlisten() { @@ -163,14 +163,13 @@ void remotio_send_to_client() } /** Fill variables after crash / shutdown from XML dumps */ void start_data(){ - - if(1 == 0){ - // retrieve total_finished_jobs and total_finished_frames from xml file - } - else{ - general_info.total_finished_jobs = 0; - general_info.total_frames_rendered = 0; - } + if(1 == 0){ + // retrieve total_finished_jobs and total_finished_frames from xml file + } + else{ + general_info.total_finished_jobs = 0; + general_info.total_frames_rendered = 0; + } } // **** Finish-Setter: Sets a frame to the "completed" status. @@ -184,9 +183,9 @@ void finish_frame(struct blendjob *blend // **** Queuer: Adds files to the queue void queue(struct blendjob *blendjob, int type, char *name, char *submitter, char *email, int priority, int mode, int spp, struct frameset *frameset) { - // Type: 1 = blender, add more types later - // jobnum is the next available job number - if(type == 1){ + // Type: 1 = blender, add more types later + // jobnum is the next available job number + if(type == 1){ blendjob->name = name; blendjob->submitter = submitter; blendjob->email = email; @@ -298,18 +297,18 @@ void frame_num_struct_builder(struct ble int jobnum_new = highest_jobnum + 1; /* global vars will someday leave us */ unsigned int counter; - job->frameset = malloc(sizeof(struct frameset) * numframes); - if(!job->frameset) - fprintf(stderr, "error allocating memory"); + job->frameset = malloc(sizeof(struct frameset) * numframes); + if(!job->frameset) + fprintf(stderr, "error allocating memory"); - job->total_frames = numframes; // sets the total number of frames in animation for status purposes - job->jobnum = jobnum_new; + job->total_frames = numframes; // sets the total number of frames in animation for status purposes + job->jobnum = jobnum_new; - for(counter = 0; counter < numframes; counter ++) - /* This builds the array, with the array starting at zero and the frameset.num starting at sframe */ - job->frameset[counter].num = counter + startframe; + for(counter = 0; counter < numframes; counter ++) + /* This builds the array, with the array starting at zero and the frameset.num starting at sframe */ + job->frameset[counter].num = counter + startframe; - highest_jobnum++; // After it has created the job, it adds one to the highest_jobnum interger + highest_jobnum++; // After it has created the job, it adds one to the highest_jobnum interger } @@ -338,41 +337,41 @@ int frame_finder(struct blendjob *head, { /* enumerate through priority levels */ for(priority = 10; - priority > 0 - && !found; - priority --) + priority > 0 + && !found; + priority --) /* Find the job with the highest priority */ - for(blendjob_ptr = head; - blendjob_ptr != NULL - && !found; - blendjob_ptr = blendjob_ptr->next) - if(blendjob_ptr->priority == priority) + for(blendjob_ptr = head; + blendjob_ptr != NULL + && !found; + blendjob_ptr = blendjob_ptr->next) + if(blendjob_ptr->priority == priority) found = 1; if(!found) - { - fprintf(stderr, "out of jobs to render\n"); - return 1; - } + { + fprintf(stderr, "out of jobs to render\n"); + return 1; + } found = 0; for(your_frame = 0; - your_frame < blendjob_ptr->total_frames; - your_frame ++) - if(blendjob_ptr->frameset[your_frame].status == 0) - found = 1; + your_frame < blendjob_ptr->total_frames; + your_frame ++) + if(blendjob_ptr->frameset[your_frame].status == 0) + found = 1; if(!found) - { - /* there are no frames left in this job */ - blendjob_ptr->priority --; + { + /* there are no frames left in this job */ + blendjob_ptr->priority --; /* If that job had no open frames for some reason, run the status report generator so that */ - status_report_generator(&head); + status_report_generator(&head); - /* should the job be removed now? */ - fprintf(stderr, "Job %d is finished, this is probably the place to call the job-removal function\n", blendjob_ptr->jobnum); - } + /* should the job be removed now? */ + fprintf(stderr, "Job %d is finished, this is probably the place to call the job-removal function\n", blendjob_ptr->jobnum); + } } /* while(!found) */ fprintf(stderr, "Missing apostrophe !!!!!!!!!!!!!!\n"); abort(); @@ -402,12 +401,12 @@ void blend_frame_watchdog(struct blendjo for(counter = 0; counter < blendjob_ptr->total_frames; counter ++) /* iterate through all frames for this job*/ { - if((blendjob_ptr->frameset[counter].start_time + (watchdog_forgiveness * 3600)) < clock()) - /* - If frame is not completed within the number of hours specified by watchdog_forgiveness - Then change the frame status to unassigned - */ - blendjob_ptr->frameset[counter].status = 0; + if((blendjob_ptr->frameset[counter].start_time + (watchdog_forgiveness * 3600)) < clock()) + /* + If frame is not completed within the number of hours specified by watchdog_forgiveness + Then change the frame status to unassigned + */ + blendjob_ptr->frameset[counter].status = 0; } } @@ -426,7 +425,7 @@ struct blendjob *blendjob_get(struct ble */ for(blendjob_ptr = head; blendjob_ptr - && blendjob_ptr->jobnum != jobnum; + && blendjob_ptr->jobnum != jobnum; blendjob_ptr = blendjob_ptr->next); return blendjob_ptr; @@ -448,9 +447,9 @@ void blendjob_remove(struct blendjob **h { for(previous_blendjob = *head; - previous_blendjob - && previous_blendjob->next != bj; /*< stop on the blendjob that comes before bj */ - previous_blendjob = previous_blendjob->next) + previous_blendjob + && previous_blendjob->next != bj; /*< stop on the blendjob that comes before bj */ + previous_blendjob = previous_blendjob->next) /* all of the action is in the definition of the for loop itself */; /* @@ -482,28 +481,28 @@ int distrend_do_config(int argc, char *a cfg_opt_t myopts[] = { CFG_SEC("listen", /* this must be imported into struct listens (which must still be declared) */ - myopts_listen, - CFGF_MULTI), + myopts_listen, + CFGF_MULTI), CFG_SIMPLE_STR("datadir", NULL), CFG_END() }; - + fprintf(stderr, "%s:%d running config\n", __FILE__, __LINE__); *config = malloc(sizeof(struct distrend_config)); myopts[1].simple_value = &(*config)->datadir; - + options_init(argc, argv, &(*config)->mycfg, myopts, "server", &(*config)->options); - fprintf(stderr, "using %s as datadir\n", (*config)->datadir); - + fprintf(stderr, "using %s as datadir\n", (*config)->datadir); + return 0; } int distrend_config_free(struct distrend_config *config) { options_free(config->options); free(config); - + return 0; } // End non-working framework? @@ -571,9 +570,9 @@ int main(int argc, char *argv[]) /* If the client states that they finished the frame */ if(clientsays == DISTREN_REQUEST_DONEFRAME){ - clientstatus = CLIENTSTATUS_IDLE; // Sets the client back to idle - // finish_frame(jobnum, framenumprevious); // make it finish the previous frame or something, why framenumprevios? Is that the whole linked list thing coming in? - finish_frame(head, jobnum); // @TODO: update so it fits the purpose of the previous line + clientstatus = CLIENTSTATUS_IDLE; // Sets the client back to idle + // finish_frame(jobnum, framenumprevious); // make it finish the previous frame or something, why framenumprevios? Is that the whole linked list thing coming in? + finish_frame(head, jobnum); // @TODO: update so it fits the purpose of the previous line } /* End Somewhat Pseudo-code */