merged remaining changes from TRANSACTIONS (using cvs update -j TRANSACTIONS)
authorNathan Bryant <loanshark@uncensored.citadel.org>
Sat, 13 Jan 2001 06:40:26 +0000 (06:40 +0000)
committerNathan Bryant <loanshark@uncensored.citadel.org>
Sat, 13 Jan 2001 06:40:26 +0000 (06:40 +0000)
which should now be considered closed.

citadel/ChangeLog
citadel/Makefile.in
citadel/citserver.c
citadel/database.c
citadel/housekeeping.c
citadel/ipc_c_tcp.c
citadel/msgbase.c
citadel/serv_pas2.c
citadel/serv_vandelay.c
citadel/server.h
citadel/vcard.c

index 34e0e812946a2f82929ea2a7222b8580d4975b31..4d93612d0e56a8effb850aba081b7e6e479f8f0d 100644 (file)
@@ -1,4 +1,8 @@
  $Log$
+ Revision 573.65  2001/01/13 06:40:26  nbryant
+ merged remaining changes from TRANSACTIONS (using cvs update -j TRANSACTIONS)
+ which should now be considered closed.
+
  Revision 573.64  2001/01/13 06:12:15  ajc
  * Added the ASYN command
 
  Revision 573.52  2000/12/19 20:41:55  ajc
  * Fixed generation of unique file names for network uploads etc.
 
+ Revision 573.51.2.11  2000/12/26 05:30:55  nbryant
+ remove extraneous transaction around dynamic module initializations. this will
+ fix the crash on database creation.
+
+ Revision 573.51.2.10  2000/12/24 23:00:58  nbryant
+ clean: also remove parsedate.c
+
+ Revision 573.51.2.9  2000/12/20 01:38:42  nbryant
+ require transactional cursors
+
+ Revision 573.51.2.8  2000/12/20 00:30:01  nbryant
+ release any stale db handles at the end of a server command
+ (unfinished transactions will be aborted to annoy lazy programmers)
+
+ Revision 573.51.2.7  2000/12/19 06:18:27  nbryant
+ set sched_yield as sleepycat's yield function. this should improve locking
+ performance.
+
+ Revision 573.51.2.6  2000/12/19 02:22:29  nbryant
+ added automatic transaction start/end on cdb_fetch, cdb_delete, and cdb_store
+
+ Revision 573.51.2.5  2000/12/18 03:51:13  nbryant
+ ditto S_USER_TRANS, S_CALLLOG, and S_HOUSEKEEPING, which are no longer used at
+ all
+
+ Revision 573.51.2.4  2000/12/18 02:49:17  nbryant
+ removed all references to S_MSGMAIN critical section; it wasn't really needed.
+ this should make things significantly more scaleable.
+
+ Revision 573.51.2.3  2000/12/17 22:12:48  nbryant
+ reworked shutdown sequence to wait for worker threads to terminate before
+ checkpointing and closing databases. it is no longer safe to call
+ master_cleanup() directly to force a shutdown; instead, just set
+ time_to_die to a nonzero value
+
+ Revision 573.51.2.2  2000/12/17 05:06:09  nbryant
+ added deadlock detection and cleaned up messages
+
+ Revision 573.51.2.1  2000/12/16 21:06:59  nbryant
+ created TRANSACTIONS branch
+ track cursor and transaction id's in thread-specific data
+
  Revision 573.51  2000/12/14 18:36:34  ajc
  * Fixed the "users not in chat" wholist display
 
index 8ba00452b37a275f2a3e00a328d7177482859a5d..508ba38b036b7bd4eac7ee4609038b65e806df64 100644 (file)
@@ -369,7 +369,7 @@ install-exec: all weekly
        fi
 
 clean:
-       rm -f *.o *.ro *.mo
+       rm -f *.o *.ro *.mo parsedate.c
 
 cleaner: clean
        rm -f $(CLIENT_TARGETS) $(SERVER_TARGETS) $(UTIL_TARGETS) \
index 5b671d0fba90ad7d8dcf35faf7902677a6404ae9..08f4c4f8c4a998fc1373a722890db2972c83116d 100644 (file)
@@ -80,18 +80,12 @@ void master_startup(void) {
 
 /*
  * Cleanup routine to be called when the server is shutting down.
+ * WARNING: It's no longer safe to call this function to force a shutdown.
+ * Instead, set time_to_die = 1.
  */
 void master_cleanup(void) {
        struct CleanupFunctionHook *fcn;
 
-       /* Cancel all running sessions */
-       lprintf(7, "Cancelling running sessions...\n");
-
-/* FIXME do something here
-       while (ContextList != NULL) {
-               }
- */
-
        /* Run any cleanup routines registered by loadable modules */
        for (fcn = CleanupHookTable; fcn != NULL; fcn = fcn->next) {
                (*fcn->h_function_pointer)();
@@ -713,7 +707,7 @@ void cmd_down(void) {
        if (CtdlAccessCheck(ac_aide)) return;
 
        cprintf("%d Shutting down server.  Goodbye.\n", OK);
-       master_cleanup();
+       time_to_die = 1;
        }
 
 /*
index a95abbe174fdd18edfabac1a41cc9e8419c0c967..d562e07bcdfc7179eb7220262f54eb9d59b2e05d 100644 (file)
@@ -51,11 +51,9 @@ void defrag_databases(void)
 
        /* defrag the message base */
        lprintf(7, "Defragmenting message base\n");
-       begin_critical_section(S_MSGMAIN);
        begin_critical_section(S_DATABASE);
        gdbm_reorganize(gdbms[CDB_MSGMAIN]);
        end_critical_section(S_DATABASE);
-       end_critical_section(S_MSGMAIN);
 
        /* defrag the user file, mailboxes, and user/room relationships */
        lprintf(7, "Defragmenting user file\n");
@@ -348,3 +346,12 @@ void cdb_begin_transaction(void) {
 
 void cdb_end_transaction(void) {
 }
+
+void cdb_allocate_tsd(void) {
+}
+
+void cdb_free_tsd(void) {
+}
+
+void cdb_release_handles(void) {
+}
index a16ce58a6d09a51542a5174311233b2a7b7d0410..1f2fc70f36e3d0cc40f85e505c23df6ccfba9d84 100644 (file)
@@ -66,7 +66,7 @@ void terminate_idle_sessions(void) {
 void check_sched_shutdown(void) {
        if ((ScheduledShutdown == 1) && (ContextList == NULL)) {
                lprintf(3, "Scheduled shutdown initiating.\n");
-               master_cleanup();
+               time_to_die = 1;
        }
 }
 
index c8a3ab9d8053aba388c53b9810ac958922f0d66c..7cb4b0623d4fce8fa17c7efcdb87977090887dca 100644 (file)
@@ -29,6 +29,7 @@
 #include "citadel.h"
 #include "citadel_decls.h"
 #include "ipc.h"
+#include "tools.h"
 #ifndef HAVE_SNPRINTF
 #include "snprintf.h"
 #endif
@@ -132,7 +133,7 @@ int uds_connectsock(char *sockpath)
 
        memset(&addr, 0, sizeof(addr));
        addr.sun_family = AF_UNIX;
-       strncpy(addr.sun_path, sockpath, sizeof addr.sun_path);
+       safestrncpy(addr.sun_path, sockpath, sizeof addr.sun_path);
 
        s = socket(AF_UNIX, SOCK_STREAM, 0);
        if (s < 0) {
index 167e475dae9c40d2e4f7750181555f3c45e0972b..6c5278763ff39e1e9e2257fde0ae0bf5ca2529f6 100644 (file)
@@ -1380,7 +1380,6 @@ long send_message(struct CtdlMessage *msg,        /* pointer to buffer */
         }
 
        /* Write our little bundle of joy into the message base */
-       begin_critical_section(S_MSGMAIN);
        if (cdb_store(CDB_MSGMAIN, &newmsgid, sizeof(long),
                      smr.ser, smr.len) < 0) {
                lprintf(2, "Can't store message\n");
@@ -1388,7 +1387,6 @@ long send_message(struct CtdlMessage *msg,        /* pointer to buffer */
        } else {
                retval = newmsgid;
        }
-       end_critical_section(S_MSGMAIN);
 
        /* If the caller specified that a copy should be saved to a particular
         * file handle, do that now too.
index 7a38bf0ad1d49db0adb28201614de033f9ac0f1c..9c561bd2af6665bc179674bb38537d85dcf9d961 100644 (file)
@@ -77,5 +77,5 @@ void cmd_pas2(char *argbuf)
 char *Dynamic_Module_Init(void)
 {
         CtdlRegisterProtoHook(cmd_pas2, "PAS2", "APOP-based login");
-        return "$(RCSID)";
+        return "$Id$";
 }
index d1cbd2db857f3f60b8e31e31c8f8e5168517abd5..f54e9d7046662eb76bc3649d0d496e8e1a400da3 100644 (file)
@@ -476,9 +476,7 @@ void artv_import_message(void) {
        fread(mbuf, msglen, 1, fp);
        fclose(fp);
 
-        begin_critical_section(S_MSGMAIN);
         cdb_store(CDB_MSGMAIN, &msgnum, sizeof(long), mbuf, msglen);
-        end_critical_section(S_MSGMAIN);
 
        phree(mbuf);
        unlink(tempfile);
index c66e8fca7ce343f45d8b55cc8a4b9bb6709ace3e..33ceef4a4f2449df5222a0119bd6fedb8f406ba6 100644 (file)
@@ -160,15 +160,11 @@ struct ChatLine {
  */
 enum {
        S_USERSUPP,
-       S_USER_TRANS,
        S_QUICKROOM,
-       S_MSGMAIN,
-       S_CALLLOG,
        S_SESSION_TABLE,
        S_FLOORTAB,
        S_CHATQUEUE,
        S_CONTROL,
-       S_HOUSEKEEPING,
        S_DATABASE,
        S_NETDB,
        S_SUPPMSGMAIN,
index a34a466b0306800270a033358f41142254da1b3f..2ecc16824a0e20e07af1f222d3f4c4890ff6b3df 100644 (file)
@@ -20,7 +20,6 @@
 #include <string.h>
 #include <errno.h>
 #include <limits.h>
-#include <pthread.h>
 #include <syslog.h>
 #include "citadel.h"
 #include "server.h"