Changeset - 0be4e8427de5
[Not reviewed]
default
0 1 0
Nathan Brink (binki) - 16 years ago 2009-07-26 08:53:52
ohnobinki@ohnopublishing.net
started fixing server's main()
1 file changed with 29 insertions and 20 deletions:
0 comments (0 inline, 0 general)
src/server/distrend.c
Show inline comments
 
@@ -485,7 +485,7 @@ void blendjob_remove(struct blendjob **h
 
int main(int argc, char *argv[])
 
{
 

	
 
/* TODO: Put some arg-grabbing code here */
 
  /* TODO: Put some arg-grabbing code here */
 

	
 
  struct blendjob *head;
 

	
 
@@ -493,6 +493,13 @@ int main(int argc, char *argv[])
 
  struct distrend_listenset *listenset;
 
  struct distrend_config *config;
 

	
 
  enum clientstatus
 
  {
 
    CLIENTSTATUS_UNINITIALIZED = 0,
 
    CLIENTSTATUS_BUSY = 1,
 
    CLIENTSTATUS_IDLE = 2
 
  } clientstatus;
 

	
 
  head = NULL;
 
  cont = 1;
 

	
 
@@ -511,32 +518,34 @@ int main(int argc, char *argv[])
 
      /* 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
 
      status_report_generator(&head);
 
      blend_frame_watchdog(head);	 // TODO: Add correct args
 

	
 

	
 
      struct frameset *frame;
 
      struct blendjob *job;
 

	
 
      /* If the client is idle (meaning a client without the "busy" status connected via ssh) */
 
      	if(clientstatus == "idle")
 
	  {
 
      		int returnnum = frame_finder(&head, job, frame); // give framefinder args, framefinder should return job number and frame number somehow
 
				if(returnnum == 1){
 
					fprinf(stderr,"No frames are available to render at this time");
 
					sleep(10);
 
				}
 
				else if(returnnum == 0){
 
					remotio_send_to_client(framenum, jobnum);
 
				}
 
				else(){
 
					fprintf(stderr,"Something is terribly wrong!");
 
				}
 
      	}
 
      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
 
	  if(returnnum)
 
	    {
 
	      fprinf(stderr,"No frames are available to render at this time");
 
	      sleep(10);
 
	    }
 
	  else
 
	    /* returnnum == 0 */
 
	    remotio_send_to_client(frame->num, job->jobnum);
 
	}
 
      /* 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"
 
      	if(clientsays == DISTREN_REQUEST_DONEFRAME && iteration == 0){
 
	  clientstatus = CLIENTSTATUS_IDLE;
 
	  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 */
0 comments (0 inline, 0 general)