From 336721634c09a52e6c3fa27b54d5dc95c7ad9bee Mon Sep 17 00:00:00 2001 From: Nathan Bryant Date: Sat, 13 Jan 2001 06:40:26 +0000 Subject: [PATCH] merged remaining changes from TRANSACTIONS (using cvs update -j TRANSACTIONS) which should now be considered closed. --- citadel/ChangeLog | 46 +++++++++++++++++++++++++++++++++++++++++ citadel/Makefile.in | 2 +- citadel/citserver.c | 12 +++-------- citadel/database.c | 11 ++++++++-- citadel/housekeeping.c | 2 +- citadel/ipc_c_tcp.c | 3 ++- citadel/msgbase.c | 2 -- citadel/serv_pas2.c | 2 +- citadel/serv_vandelay.c | 2 -- citadel/server.h | 4 ---- citadel/vcard.c | 1 - 11 files changed, 63 insertions(+), 24 deletions(-) diff --git a/citadel/ChangeLog b/citadel/ChangeLog index 34e0e8129..4d93612d0 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -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 @@ -43,6 +47,48 @@ 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 diff --git a/citadel/Makefile.in b/citadel/Makefile.in index 8ba00452b..508ba38b0 100644 --- a/citadel/Makefile.in +++ b/citadel/Makefile.in @@ -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) \ diff --git a/citadel/citserver.c b/citadel/citserver.c index 5b671d0fb..08f4c4f8c 100644 --- a/citadel/citserver.c +++ b/citadel/citserver.c @@ -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; } /* diff --git a/citadel/database.c b/citadel/database.c index a95abbe17..d562e07bc 100644 --- a/citadel/database.c +++ b/citadel/database.c @@ -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) { +} diff --git a/citadel/housekeeping.c b/citadel/housekeeping.c index a16ce58a6..1f2fc70f3 100644 --- a/citadel/housekeeping.c +++ b/citadel/housekeeping.c @@ -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; } } diff --git a/citadel/ipc_c_tcp.c b/citadel/ipc_c_tcp.c index c8a3ab9d8..7cb4b0623 100644 --- a/citadel/ipc_c_tcp.c +++ b/citadel/ipc_c_tcp.c @@ -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) { diff --git a/citadel/msgbase.c b/citadel/msgbase.c index 167e475da..6c5278763 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -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. diff --git a/citadel/serv_pas2.c b/citadel/serv_pas2.c index 7a38bf0ad..9c561bd2a 100644 --- a/citadel/serv_pas2.c +++ b/citadel/serv_pas2.c @@ -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$"; } diff --git a/citadel/serv_vandelay.c b/citadel/serv_vandelay.c index d1cbd2db8..f54e9d704 100644 --- a/citadel/serv_vandelay.c +++ b/citadel/serv_vandelay.c @@ -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); diff --git a/citadel/server.h b/citadel/server.h index c66e8fca7..33ceef4a4 100644 --- a/citadel/server.h +++ b/citadel/server.h @@ -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, diff --git a/citadel/vcard.c b/citadel/vcard.c index a34a466b0..2ecc16824 100644 --- a/citadel/vcard.c +++ b/citadel/vcard.c @@ -20,7 +20,6 @@ #include #include #include -#include #include #include "citadel.h" #include "server.h" -- 2.30.2