Changeset - 930f5ea4c9a5
[Not reviewed]
default
0 2 0
Ethan Zonca (ethanzonca) - 15 years ago 2010-06-26 01:49:49
e@ethanzonca.com
Added additional error checking, fixed minor issues
2 files changed with 16 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/server/simpleslave.c
Show inline comments
 
@@ -26,13 +26,13 @@
 
#include <stdio.h>
 
#include <stdlib.h>
 
#include <string.h>
 
#include <sys/stat.h>
 
#include <unistd.h>
 

	
 
#define DEBUG 0
 
#define DEBUG 1
 

	
 

	
 
int main(int argc, char *argv[])
 
{
 
  char *datadir;
 
  char *server;
 
@@ -159,12 +159,14 @@ int main(int argc, char *argv[])
 

	
 
  int haveWork = 0;
 
  int quit = 0;
 

	
 
  fprintf(stderr,"\nDistRen SimpleSlave Pre-Alpha %s\n- Experimental build: Use at your own risk!\n\n", PACKAGE_VERSION);
 

	
 
  /* @TODO @FIXME create datadir (/var/distren/) if it doesn't exist, or notify the user */
 

	
 
  int benchmarkTime = 0;
 
  int renderPower = 0;
 

	
 
  // @TODO: create _web function to force recalc if !isset($render_power) on server
 
  if(runBenchmark)
 
    {
 
@@ -215,23 +217,34 @@ int main(int argc, char *argv[])
 
          if(DEBUG)
 
            //fprintf(stderr,"Using existing uncompressed data %s...\n", pathtoJobfile);
 
            fprintf(stderr,"Using existing tarball %s...\n", pathtoTar);
 

	
 
        // Check if tar exists already
 
        struct stat jbuffer;
 
        int jstatus = stat(pathtoTar, &jbuffer);
 
        int jstatus = stat(pathtoJobfile, &jbuffer);
 
        if(jstatus == -1){
 
          fprintf(stderr,"Main job file does not exist, extracting...\n");
 

	
 
          // If error unpacking tarball
 
          if(unpackJob(pathtoJob, pathtoTar)){
 
            _web_resetframe(slavekey, password, jobnum, framenum);  // Unassign the frame on the server so other slaves can render it
 
            fprintf(stderr,"Extraction failed, exiting.\n");
 
            return 1;
 
          }
 
        }
 
	else{
 
	  if(DEBUG)
 
	    fprintf(stderr,"Using already extracted data.\n");
 
        }
 

	
 
        struct stat tbuffer;
 
        int tstatus = stat(pathtoJobfile, &tbuffer);
 
	if(tstatus == -1){
 
          fprintf(stderr,"The main job file does not exist! Data may be corrupt, or the archive is malformatted.\n");
 
          return 1;
 
        }
 

	
 
        /* ignore return because directory may exist already */
 
        if(DEBUG)
 
          fprintf(stderr,"Creating output directory %s\n", pathtoOutdir);
 
        mkdir(pathtoOutdir, 0700);
 

	
src/server/slavefuncs.c
Show inline comments
 
@@ -349,13 +349,13 @@ int downloadTar(char *url, char *destina
 
      else if(ret == 1){
 
        fprintf(stderr, "Downloading job data from %s failed. Check your network connection.\n",url);
 
        free(url);
 
        return 1; // Eventually make a retry loop
 
      }
 
    }
 
  fprintf(stderr, "Tar already exists! Download cancelled.\n");
 
  fprintf(stderr, "Tar at %s already exists! Download cancelled.\n", destinationPath);
 
  return 2;
 
}
 

	
 

	
 
int uploadOutput(char *pathtoOutput, char *urltoOutput, int jobnum, int framenum, int slavekey){
 
  //fprintf(stderr,"Uploading output %s to url %s for job %d and frame %d for slavekey %d", pathtoOutput, urltoOutput, jobnum, framenum, slavekey);
0 comments (0 inline, 0 general)