diff --git a/src/server/distrend.c b/src/server/distrend.c --- a/src/server/distrend.c +++ b/src/server/distrend.c @@ -510,7 +510,7 @@ int distrend_config_free(struct distrend int main(int argc, char *argv[]) { - /* TODO: Put some arg-grabbing code here */ + /* @TODO: Put some arg-grabbing code here */ struct blendjob *head; @@ -518,6 +518,8 @@ int main(int argc, char *argv[]) struct distrend_listenset *listenset; struct distrend_config *config; + start_data(); // Starts fresh or loads data from xml dump + enum clientstatus { CLIENTSTATUS_UNINITIALIZED = 0, @@ -540,10 +542,7 @@ int main(int argc, char *argv[]) distrend_accept(&action); cont = distrend_do(action); - - /* Somewhat Pseudo-code for basic server operation, should be more event-driven */ - - start_data(); + /* Make the following code more event-driven */ status_report_generator(&head); blend_frame_watchdog(head); @@ -551,33 +550,26 @@ int main(int argc, char *argv[]) struct frameset *frame; struct blendjob *job; - /* If the client is idle (meaning a client without the "busy" status connected via ssh), all clients should be idle by default. */ + /* If the client is idle, must be modified for climbing through linked list of clients (client->clientnum) */ if(clientstatus == CLIENTSTATUS_IDLE) { - /** - normaldotcom: learn about ``return by pointer'' - */ - int returnnum = frame_finder(head, &job, &frame); // give framefinder args, framefinder should return job number and frame number somehow + int returnnum = frame_finder(head, &job, &frame); // Finds a frame to render if(returnnum) { - fprintf(stderr,"No frames are available to render at this time"); + fprintf(stderr,"No frames are available to render at this time. Idling...\n"); sleep(10); } else /* returnnum == 0 */ - remotio_send_to_client(frame->num, job->jobnum); // Did you actually make this function, ohnobinki? --normaldotcom + 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){ 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 + finish_frame(head, frame->num); // @TODO: Check that finish_frame really gets the jobnum somehow } - /* End Somewhat Pseudo-code */ - - distrend_action_free(action); }