Rhizome now uses serval.conf to get rhizome database size limit.

This commit is contained in:
gardners 2012-03-05 12:05:12 +13:00 committed by Jeremy Lakeman
parent 2a2e520ef5
commit ec8a81c206
3 changed files with 9 additions and 21 deletions

View File

@ -277,7 +277,10 @@ int app_server_stop(int argc,char **argv,struct command_line_option *o)
switch (errno) {
case EINVAL: WHY("This is embarassing, but the operating system says I don't know how to send a signal."); break;
case EPERM: WHY("I don't have permission to stop the Serval process. You could try using sudo, or run the stop command as the appropriate user."); break;
case ESRCH: WHY("The process id I have recorded doesn't seem to exist anymore. Did someone kill the process without telling me?"); break;
case ESRCH: WHY("The process id I have recorded doesn't seem to exist anymore. Did someone kill the process without telling me?");
/* Clean up any lingering mess */
servalShutdownCleanly();
break;
default:
perror("This is reason given by the operating system");
}

View File

@ -54,26 +54,10 @@ int rhizome_opendb()
exit(1);
}
/* Read Rhizome configuration, and write it back out as we understand it. */
char conf[1024];
snprintf(conf,1024,"%s/rhizome.conf",rhizome_datastore_path);
FILE *f=fopen(conf,"r");
if (f) {
char line[1024];
line[0]=0; fgets(line,1024,f);
while (line[0]) {
if (sscanf(line,"space=%lld",&rhizome_space)==1) {
rhizome_space*=1024; /* Units are kilobytes */
}
line[0]=0; fgets(line,1024,f);
}
fclose(f);
}
f=fopen(conf,"w");
if (f) {
fprintf(f,"space=%lld\n",rhizome_space/1024LL);
fclose(f);
}
/* Read Rhizome configuration */
rhizome_space=1024LL*atof(confValueGet("rhizome_kb","1024"));
fprintf(stderr,"Rhizome will use %lldKB of storage for its database.\n",
rhizome_space/1024LL);
/* Create tables if required */
if (sqlite3_exec(rhizome_db,"PRAGMA auto_vacuum=2;",NULL,NULL,NULL)) {

View File

@ -306,6 +306,7 @@ extern int hexdigit[16];
extern int sock;
void servalShutdownCleanly();
char *confValueGet(char *var,char *defaultValue);
int recvwithttl(int sock,unsigned char *buffer,int bufferlen,int *ttl,
struct sockaddr *recvaddr,unsigned int *recvaddrlen);
int stowSid(unsigned char *packet,int ofs,char *sid);