diff --git a/src/server/distrend.c b/src/server/distrend.c --- a/src/server/distrend.c +++ b/src/server/distrend.c @@ -154,11 +154,11 @@ int main(int argc, char *argv[]) /* Main Loop */ while(!general_info.config->die) { - int clientsays = 0; /*< temporary example variable, will be replaced when we can handle messages */ + int clientrequest = 0; /*< temporary example variable, will be replaced when we can handle messages */ distrend_accept(general_info.config, clients); - /* Make the following code more event-driven */ + /* Run the watchdog, @TODO: like every 10 mins or something */ frame_watchdog(general_info.conn); struct frameset frame; @@ -167,20 +167,16 @@ int main(int argc, char *argv[]) memset(&frame, '\0', sizeof(frame)); - /* If the client is idle, must be modified for climbing through linked list of clients (client->clientnum) */ - if(clientstatus == CLIENTSTATUS_IDLE) + /** If client requests work */ + if(clientrequest == DISTREN_REQUEST_GETWORK) { int returnnum = find_jobframe(general_info.conn, slaveKey, &job->jobnum, &frame.num); // Finds a frame to render @FIXME: Slavenum :D - if(returnnum) - { - fprintf(stderr,"No frames are available to render at this time. Idling...\n"); - sleep(10); - } + if(returnnum); /* No work on server */ else remotio_send_to_client(frame.num, job->jobnum); // Pseudo-sends data to client } /* If the client states that they finished the frame */ - if(clientsays == DISTREN_REQUEST_DONEFRAME) + else if(clientrequest == DISTREN_REQUEST_DONEFRAME) { clientstatus = CLIENTSTATUS_IDLE; // Sets the client back to idle finish_frame(general_info.conn, 0, job->jobnum, frame.num); // @TODO: Make sure this actually works. @@ -211,7 +207,7 @@ int distrend_do() } /* Grabs config info from confs */ -int distrend_do_config(int argc, char *argv[], struct distrend_config **config) +int distrend_do_csonfig(int argc, char *argv[], struct distrend_config **config) { unsigned int counter;