No more cleanup hooks. The OS can reclaim memory better than we can. We want to...
[citadel.git] / citadel / database.c
index 74aa3df4418af7adb1d4bf917473eee4d102b1ca..2f6a5b5cedfe41f1b17fa58a0aba7a0cc037ef05 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This is a data store backend for the Citadel server which uses Berkeley DB.
  *
- * Copyright (c) 1987-2020 by the citadel.org team
+ * Copyright (c) 1987-2021 by the citadel.org team
  *
  * This program is open source software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License version 3.
@@ -317,7 +317,7 @@ void close_databases(void) {
 
        syslog(LOG_INFO, "db: performing final checkpoint");
        if ((ret = dbenv->txn_checkpoint(dbenv, 0, 0, 0))) {
-               syslog(LOG_ERR, "txn_checkpoint: %s", db_strerror(ret));
+               syslog(LOG_ERR, "db: txn_checkpoint: %s", db_strerror(ret));
        }
 
        syslog(LOG_INFO, "db: flushing the database logs");
@@ -325,11 +325,6 @@ void close_databases(void) {
                syslog(LOG_ERR, "db: log_flush: %s", db_strerror(ret));
        }
 
-#ifdef DB_STAT_ALL
-       /* print some statistics... */
-       dbenv->lock_stat_print(dbenv, DB_STAT_ALL);
-#endif
-
        /* close the tables */
        syslog(LOG_INFO, "db: closing databases");
        for (i = 0; i < MAXCDB; ++i) {
@@ -341,6 +336,12 @@ void close_databases(void) {
 
        }
 
+       // This seemed nifty at the time but did anyone really look at it?
+       // #ifdef DB_STAT_ALL
+       // /* print some statistics... */
+       // dbenv->lock_stat_print(dbenv, DB_STAT_ALL);
+       // #endif
+
        /* Close the handle. */
        ret = dbenv->close(dbenv, 0);
        if (ret) {
@@ -797,52 +798,10 @@ int CheckIfAlreadySeen(StrBuf *guid) {
 }
 
 
-void cmd_rsen(char *argbuf) {
-       char Token[SIZ];
-       long TLen;
-       char Time[SIZ];
-
-       struct UseTable ut;
-       struct cdbdata *cdbut;
-
-       if (CtdlAccessCheck(ac_aide)) {
-               return;
-       }
-
-       TLen = extract_token(Token, argbuf, 1, '|', sizeof Token);
-       if (strncmp(argbuf, "GET", 3) == 0) {
-               cdbut = cdb_fetch(CDB_USETABLE, Token, TLen);
-               if (cdbut != NULL) {
-                       memcpy(&ut, cdbut->ptr, ((cdbut->len > sizeof(struct UseTable)) ? sizeof(struct UseTable) : cdbut->len));
-
-                       cprintf("%d %ld\n", CIT_OK, ut.ut_timestamp);
-               } else {
-                       cprintf("%d not found\n", ERROR + NOT_HERE);
-               }
-
-       } else if (strncmp(argbuf, "SET", 3) == 0) {
-               memcpy(ut.ut_msgid, Token, TLen);
-               extract_token(Time, argbuf, 2, '|', sizeof Time);
-               ut.ut_timestamp = atol(Time);
-               cdb_store(CDB_USETABLE, Token, TLen, &ut, sizeof(struct UseTable));
-               cprintf("%d token updated\n", CIT_OK);
-       } else if (strncmp(argbuf, "DEL", 3) == 0) {
-               if (cdb_delete(CDB_USETABLE, Token, TLen))
-                       cprintf("%d not found\n", ERROR + NOT_HERE);
-               else
-                       cprintf("%d deleted.\n", CIT_OK);
-
-       } else {
-               cprintf("%d Usage: [GET|SET|DEL]|Token|timestamp\n", ERROR);
-       }
-
-}
-
-
 CTDL_MODULE_INIT(database)
 {
        if (!threading) {
-               CtdlRegisterProtoHook(cmd_rsen, "RSEN", "manipulate Aggregators seen database");
+               // nothing to do here
        }
 
        /* return our module id for the log */