From 35dedf8e228d90f180f97812d38783f2b1e99640 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 29 Sep 1998 17:25:52 +0000 Subject: [PATCH] * Removed code from some of the utilities which was still attempting to access the old non-gdbm data store. * housekeeping.c: rewrote check_ref_counts() to do a ForEachRoom() traversal instead of a MAXROOMS loop. * sysdep.c: set up a dummy CitContext record to be used during server startup, during which time there is no real context. --- citadel/ChangeLog | 8 ++++++ citadel/citserver.c | 1 - citadel/housekeeping.c | 28 ++++++++++---------- citadel/msgbase.c | 10 +++++--- citadel/netproc.c | 42 ++++++------------------------ citadel/rcit.c | 58 +++++------------------------------------- citadel/sysdep.c | 17 ++++++------- 7 files changed, 52 insertions(+), 112 deletions(-) diff --git a/citadel/ChangeLog b/citadel/ChangeLog index f1b157162..cbb7dc938 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,3 +1,11 @@ +Tue Sep 29 13:20:14 EDT 1998 Art Cancro + * Removed code from some of the utilities which was still attempting + to access the old non-gdbm data store. + * housekeeping.c: rewrote check_ref_counts() to do a ForEachRoom() + traversal instead of a MAXROOMS loop. + * sysdep.c: set up a dummy CitContext record to be used during server + startup, during which time there is no real context. + Mon Sep 28 23:51:51 EDT 1998 Art Cancro * Implemented the function ForEachRoom() to handle all-rooms traversal (this will work with both the old and new paradigms, because both diff --git a/citadel/citserver.c b/citadel/citserver.c index 781e41893..5219cdb62 100644 --- a/citadel/citserver.c +++ b/citadel/citserver.c @@ -38,7 +38,6 @@ void master_startup(void) { lprintf(7, "Checking floor reference counts\n"); check_ref_counts(); - } /* diff --git a/citadel/housekeeping.c b/citadel/housekeeping.c index bff891087..2458fa861 100644 --- a/citadel/housekeeping.c +++ b/citadel/housekeeping.c @@ -71,27 +71,29 @@ void do_housekeeping(void) { /* * Check (and fix) floor reference counts. This doesn't need to be done * very often, since the counts should remain correct during normal operation. + * NOTE: this function pair should ONLY be called during startup. It is NOT + * thread safe. */ +void check_ref_counts_backend(struct quickroom *qrbuf) { + struct floor flbuf; + + lgetfloor(&flbuf, qrbuf->QRfloor); + ++flbuf.f_ref_count; + flbuf.f_flags = flbuf.f_flags | QR_INUSE; + lputfloor(&flbuf, qrbuf->QRfloor); + } + void check_ref_counts(void) { - int ref[MAXFLOORS]; - struct quickroom qrbuf; struct floor flbuf; int a; - for (a=0; a 0) flbuf.f_flags = flbuf.f_flags | QR_INUSE ; + flbuf.f_ref_count = 0; + flbuf.f_flags = flbuf.f_flags & ~QR_INUSE; lputfloor(&flbuf, a); } + + ForEachRoom(check_ref_counts_backend); } diff --git a/citadel/msgbase.c b/citadel/msgbase.c index 076eee5e2..d9b570c83 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -139,11 +139,11 @@ void get_mm(void) { */ void cmd_msgs(char *cmdbuf) { - int a; - int mode; + int a = 0; + int mode = 0; char which[256]; - int cm_howmany; - long cm_gt; + int cm_howmany = 0; + long cm_gt = 0L; extract(which,cmdbuf,0); @@ -651,6 +651,8 @@ long send_message(char *message_in_memory, /* pointer to buffer */ /* FIX ... rewrite this to simply check for the existence of the twitroom, * and create it if necessary. No slot-numbers will need to be loaded. + * (Actually, twitroom should be created during the same portion of startup + * that creates Lobby/Mail/Aide.) */ void loadtroom(void) { struct quickroom qrbuf; diff --git a/citadel/netproc.c b/citadel/netproc.c index 52dafca1c..5f18db114 100644 --- a/citadel/netproc.c +++ b/citadel/netproc.c @@ -103,8 +103,6 @@ void serv_write(char *buf, int nbytes); void get_config(void); struct filterlist *filter = NULL; -char roomnames[MAXROOMS][20]; -char roomdirs[MAXROOMS][15]; struct syslist *slist = NULL; struct config config; @@ -133,30 +131,6 @@ void strip_trailing_whitespace(char *buf) } -/* - * for performance optimization, netproc loads the list of room names (and - * their corresponding directory names, if applicable) into a table in memory. - */ -int load_roomnames(void) { - FILE *fp; - struct quickroom qbuf; - int i; - - fp=fopen("./quickroom","rb"); - if (fp==NULL) return(1); - for (i=0; i=0)); @@ -610,7 +585,7 @@ void proc_file_transfer(char *tname) return; } - sprintf(buf,"cd %s/files/%s; exec %s",bbs_home_directory,dest_dir,UUDECODE); + sprintf(buf,"cd %s/files/%s; exec %s",bbs_home_directory,config.c_bucket_dir,UUDECODE); uud=(FILE *)popen(buf,"w"); if (uud==NULL) { printf("netproc: cannot open uudecode pipe\n"); @@ -1275,7 +1250,6 @@ void main(int argc, char **argv) np_attach_to_server(); fflush(stdout); - if (load_roomnames()!=0) fprintf(stdout,"netproc: cannot load rooms\n"); if (load_syslist()!=0) fprintf(stdout,"netproc: cannot load sysinfo\n"); setup_special_nodes(); diff --git a/citadel/rcit.c b/citadel/rcit.c index 6ab12e1e3..6f1ef65a3 100644 --- a/citadel/rcit.c +++ b/citadel/rcit.c @@ -1,7 +1,7 @@ #define UNCOMPRESS "/usr/bin/gunzip" -/* Citadel/UX rnews - * version 2.8 +/* Citadel/UX rcit + * version 2.9 * * This program functions the same as the standard rnews program for * UseNet. It accepts standard input, and looks for rooms to post messages @@ -36,29 +36,10 @@ void get_config(void); struct config config; -char roomlist[MAXROOMS][20]; - -void load_roomlist(void) { - FILE *fp; - struct quickroom QRtemp; - int a; - - for (a=0; a