diff --git a/src/server/slave.c b/src/server/slave.c --- a/src/server/slave.c +++ b/src/server/slave.c @@ -27,13 +27,13 @@ * ********************************************************************************** */ -// Provides DISTREN_REQUEST* which is in reality, DISTREN_SEND(signal) +// Provides DISTREN_REQUEST* which is in reality, DISTREN_SEND(signal) in the minds of your average joe #include "protocol.h" int main(int argc, char *arvg[]) { - ///////////////////// Semi-pseudo Slave Code /////////////////////////// + /* Semi-pseudo Slave Code */ int slavestatus = 0; @@ -54,7 +54,14 @@ int main(int argc, char *arvg[]) fprintf(stderr, "Got frame %d in job %d, preparing to render...",frame,job); get('http://distren.protofusion.org/srv/job#.tgz'); exec('tar -xvf job#.tgz /tmp/distren/job#'); // somehow - exec_blender(jobname.blendfile, jobnum.framenum.JPG, jobnum); // (check the args, we'll need to adjust for different output formats)... set SLAVESTATUS=1 while rendering, SLAVESTATUS=2 when done + exec_blender(jobname.blendfile, jobnum.framenum.JPG, jobnum); // (check the args, we'll need to adjust for different output formats, include this in the blendjob struct later) + while('blender is running'){ + SLAVESTATUS=1; // really quite pointless now, but why not. Could be nice for logging. + tell_the_server(DISTREN_REQUEST_PROGRESS); + fprintf(stderr, "Rendering frame %d in job %d...",framenum,jobnum); + delay(1000); // or not... this should be more event-driven, but should still give a heartbeat to the server + } + SLAVESTATUS=2; // When done rendering, set this. } if(SLAVESTATUS==2){ fprintf(stderr, "Finished frame %d in job %d",framenum,jobnum); @@ -64,11 +71,6 @@ int main(int argc, char *arvg[]) tell_the_server(DISTREN_REQUEST_DONEFRAME); fprintf(stderr, "Idle. No frames to render."); } - while(SLAVESTATUS==1){ - tell_the_server(DISTREN_REQUEST_PROGRESS); - fprintf(stderr, "Rendering frame %d in job %d...",framenum,jobnum); - delay(1000); // or not... this should be more event-driven, but should still give a heartbeat to the server - } return 0; }