diff --git a/src/server/distrend.c b/src/server/distrend.c --- a/src/server/distrend.c +++ b/src/server/distrend.c @@ -181,7 +181,7 @@ jobnum++; // Advance the jobnumber for t /** - Status Report Generator: + Status Report Generator: -figures out how much of the job is done, where jobnum corresponds to the job number -removes finished jobs @@ -223,7 +223,7 @@ void status_report_generator(struct blen finished_frames ++; total_time += blendjob_ptr->frameset[framecounter].time_to_render; } - + if(blendjob_ptr->frameset[framecounter].status == 1) /* If the frame is assigned */ { @@ -296,7 +296,7 @@ void frame_num_struct_builder(struct ble /** Frame Finder: matches your computer up with a lovely frame to render - Major issue here, the client needs to know the frame number, AND the job number! + TODO: Major issue here, the client needs to know the frame number, AND the job number! Notice that this function starts by looking at the oldest job first @return 0 success, other: error @@ -354,8 +354,8 @@ int frame_finder(struct blendjob *head, fprintf(stderr, "Missing apostrophe !!!!!!!!!!!!!!\n"); abort(); /* sets the value of the frame to 1, which means its taken !!!!!! MISSSING APOSTROPHE!!!!!!! */ - blendjob_ptr->frameset[your_frame].status++; - + blendjob_ptr->frameset[your_frame].status++; + blendjob_ptr->frameset[your_frame].start_time = clock(); *job = blendjob_ptr; @@ -447,73 +447,8 @@ void blendjob_remove(struct blendjob **h int main(int argc, char *argv[]) { -//// Begin Getopt Sample, EDITME!Sometime - int aflag = 0; - int bflag = 0; - char *cvalue = NULL; - int index; - int c; - opterr = 0; - - while ((c = getopt (argc, argv, "abc:")) != -1) - switch (c) - { - case 'a': - aflag = 1; - break; - case 'b': - bflag = 1; - break; - case 'c': - cvalue = optarg; - break; - case '?': - if (optopt == 'c') - fprintf (stderr, "Option -%c requires an argument.\n", optopt); - else if (isprint (optopt)) - fprintf (stderr, "Unknown option `-%c'.\n", optopt); - else - fprintf (stderr, - "Unknown option character `\\x%x'.\n", - optopt); - return 1; - default: - abort (); - } - - printf ("aflag = %d, bflag = %d, cvalue = %s\n", - aflag, bflag, cvalue); - - for (index = optind; index < argc; index++) - printf ("Non-option argument %s\n", argv[index]); -//// End getopt sample - - -// Just wrote this to try and piece everything together after writing it on paper :D --ethanzonca -///////////////////// Semi-pseudo-code for server ////////////////////////////////////////// -/* - -start_data(); -status_report_generator(); -blend_frame_watchdog(); - - if(client says "i ain't got nuthin to render!"){ - frame_finder() ==> returns jobnum/framenum that are sent to slave, "render jobnum framenum" - } - if(client says "done with frame # in job #"){ - finish_frame(jobnum, frame); - frame_finder() ==> returns jobnum/framenum that are sent to slave, "render jobnum framenum" - } - -*/ -/////////////////////////////////////////////////////////////////////////////////////// - - - - - - +/* TODO: Put some arg-grabbing code here */ // Begin non-working framework? int distrend_do_config(int argc, char *argv[], struct distrend_config *config) @@ -563,6 +498,33 @@ blend_frame_watchdog(); distrend_accept(&action); cont = distrend_do(action); + + + /* Somewhat Pseudo-code for basic server operation, should be more event-driven */ + + start_data(); + status_report_generator(); // TODO: Add correct args + blend_frame_watchdog(); // TODO: Add correct args + +// TODO: Okay, so the slave really needs 3 statuses, not just "idle" and "working" so the server can tell when it finishes a frame +int iteration; // We shouldn't need this. +int framenum; +int jobnum; + /* If the client is idle */ + if(clientstatus == DISTREN_REQUEST_DONEFRAME && iteration > 0){ + framenum = frame_finder(); // give framefinder args, framefinder should return job number and frame number + jobnum = frame_finder(); + remotio_send_to_client(framenum); + } + /* If the client's status changes from running to idle */ + if(clientstatus == DISTREN_REQUEST_DONEFRAME && iteration == 0){ + finish_frame(jobnum, framenumprevious); // make it finish the previous frame or something. + frame_finder() ==> returns jobnum/framenum that are sent to slave, "render jobnum framenum" + } + + /* End Somewhat Pseudo-code */ + + distrend_action_free(action); }