diff --git a/src/common/protocol.h b/src/common/protocol.h --- a/src/common/protocol.h +++ b/src/common/protocol.h @@ -22,16 +22,16 @@ */ /** - generic, shared requests + generic, shared requests */ enum distren_request_type { - DISTREN_REQUEST_VERSION = 1, /*< identifies the version of software being + DISTREN_REQUEST_VERSION = 1, /*< identifies the version of software being used by the sender and tells if it is a client or server */ - DISTREN_REQUEST_PING = 2, + DISTREN_REQUEST_PING = 2, DISTREN_REQUEST_PONG = 3, DISTREN_REQUEST_DISCONNECT = 4, - + /** client->server only requests */ @@ -51,5 +51,7 @@ enum distren_request_type server->server */ DISTREN_REQUEST_RENDERFRAME = 8, - DISTREN_REQUEST_DONEFRAME = 9 + DISTREN_REQUEST_DONEFRAME = 9, + DISTREN_REQUEST_PROGRESS = 10, /*< tells another server of the progress of the first server's work at rendering */ + }; diff --git a/src/server/slave.c b/src/server/slave.c --- a/src/server/slave.c +++ b/src/server/slave.c @@ -27,11 +27,15 @@ * ********************************************************************************** */ +// Provides DISTREN_REQUEST* which is in reality, DISTREN_SEND(signal) +#include "protocol.h" + int main(int argc, char *arvg[]) { ///////////////////// Semi-pseudo Slave Code /////////////////////////// + int slavestatus = 0; if('no username in config file, no key present'){ @@ -53,16 +57,15 @@ int main(int argc, char *arvg[]) 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 } if(SLAVESTATUS==2){ - tell_the_server("Completed"); fprintf(stderr, "Finished frame %d in job %d",framenum,jobnum); SLAVESTATUS=0; } if(SLAVESTATUS==0){ - tell_the_server("Idle"); + tell_the_server(DISTREN_REQUEST_DONEFRAME); fprintf(stderr, "Idle. No frames to render."); } while(SLAVESTATUS==1){ - tell_the_server("Rendering"); + 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 }