diff --git a/src/server/slave.c b/src/server/slave.c --- a/src/server/slave.c +++ b/src/server/slave.c @@ -102,12 +102,15 @@ int main(int argc, char *argv[]) struct distrenjob *myjob; /* Structure to hold data gathered from the XML file */ - /* If the server says that every frame for jobnum is finished */ - if(1 == 0) + /* If the server says that every frame for the last jobnum is finished, + * OR if the data is getting old + */ + if(1 == 0){ delete_jobdata(jobnum, datadir); + } - /* If the slave is getting job info... */ - if(gotframe == 1) + /* If we got a frame */ + if(gotframe != 0) { /* @TODO: Add remotio hooks */ // jobnum = remoteio_read(jobnum); /* Set jobnum from remoteio (we could use info from struct, but we need this info to download the xmlfile */ @@ -128,18 +131,16 @@ int main(int argc, char *argv[]) _distren_asprintf(&urltoOutput, "http://protofusion.org/distren/stor/tmp/", jobdatapath ); // Prepares the URL where output is posted _distren_asprintf(&pathtoXml, "%s/job%d/job%d.xml", datadir, jobnum ); // Prepares the path to the job's XML file - // Downloads the job tar if it isn't present. @TODO: Delete old job data + // Downloads the job tar if it isn't present. struct stat buffer; int fstatus = stat(pathtoJobfile, &buffer); - - /* If stat'ing the jobfile shows that the jobfile doesn't exist, we'll download it. */ if(fstatus == -1) { - /* Downloads the Tar @TODO: add progress bar */ + /* Downloads the Tar */ if( curlget(urltoTar, pathtoTar) == 0) - fprintf(stderr, "File downloaded without errors\n"); + fprintf(stderr, "Job data retrieved successfully\n"); else - fprintf(stderr, "Download tar from server failed. Either the server is down, or the job hosting system is screwed up.\nContact admin@protofusion.org and include this message.\nGoodbye. Better luck next time.\n"); + fprintf(stderr, "Downloading job data from server failed. Check your network connection.\n"); } else fprintf(stderr, "Using cached job file...\n");