mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-01-19 03:06:28 +00:00
Rhizome now uses serval.conf to get rhizome database size limit.
This commit is contained in:
parent
2a2e520ef5
commit
ec8a81c206
@ -277,7 +277,10 @@ int app_server_stop(int argc,char **argv,struct command_line_option *o)
|
|||||||
switch (errno) {
|
switch (errno) {
|
||||||
case EINVAL: WHY("This is embarassing, but the operating system says I don't know how to send a signal."); break;
|
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 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:
|
default:
|
||||||
perror("This is reason given by the operating system");
|
perror("This is reason given by the operating system");
|
||||||
}
|
}
|
||||||
|
@ -54,26 +54,10 @@ int rhizome_opendb()
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read Rhizome configuration, and write it back out as we understand it. */
|
/* Read Rhizome configuration */
|
||||||
char conf[1024];
|
rhizome_space=1024LL*atof(confValueGet("rhizome_kb","1024"));
|
||||||
snprintf(conf,1024,"%s/rhizome.conf",rhizome_datastore_path);
|
fprintf(stderr,"Rhizome will use %lldKB of storage for its database.\n",
|
||||||
FILE *f=fopen(conf,"r");
|
rhizome_space/1024LL);
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create tables if required */
|
/* Create tables if required */
|
||||||
if (sqlite3_exec(rhizome_db,"PRAGMA auto_vacuum=2;",NULL,NULL,NULL)) {
|
if (sqlite3_exec(rhizome_db,"PRAGMA auto_vacuum=2;",NULL,NULL,NULL)) {
|
||||||
|
1
serval.h
1
serval.h
@ -306,6 +306,7 @@ extern int hexdigit[16];
|
|||||||
extern int sock;
|
extern int sock;
|
||||||
|
|
||||||
void servalShutdownCleanly();
|
void servalShutdownCleanly();
|
||||||
|
char *confValueGet(char *var,char *defaultValue);
|
||||||
int recvwithttl(int sock,unsigned char *buffer,int bufferlen,int *ttl,
|
int recvwithttl(int sock,unsigned char *buffer,int bufferlen,int *ttl,
|
||||||
struct sockaddr *recvaddr,unsigned int *recvaddrlen);
|
struct sockaddr *recvaddr,unsigned int *recvaddrlen);
|
||||||
int stowSid(unsigned char *packet,int ofs,char *sid);
|
int stowSid(unsigned char *packet,int ofs,char *sid);
|
||||||
|
Loading…
Reference in New Issue
Block a user