]> code.citadel.org Git - citadel.git/blobdiff - citadel/serv_extensions.c
Wait longer (30 seconds instead of 10) to connect to Citadel server when running...
[citadel.git] / citadel / serv_extensions.c
index 4b4e44c08ab958bdb32478fa6e1629dbaaf3cd8b..f4a963cf7bf9ad2c124449ad8e7b9103dbaffafe 100644 (file)
@@ -1,8 +1,8 @@
 /*
- * Citadel Dynamic Loading Module
+ * Citadel Extension Loader
  * Written by Brian Costello <btx@calyx.net>
  *
- * Copyright (c) 1987-2011 by the citadel.org team
+ * Copyright (c) 1987-2015 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.
 
 #include "serv_extensions.h"
 #include "ctdl_module.h"
+#include "config.h"
 
 
 int DebugModules = 0;
+int EnableMarkers = 0;
+int EnableCtlProto = 0;
+
 /*
  * Structure defentitions for hook tables
  */
@@ -298,22 +301,6 @@ int DLoader_Exec_Cmd(char *cmdbuf)
        return 0;
 }
 
-long FourHash(const char *key, long length) 
-{
-       int i;
-       int ret = 0;
-       const unsigned char *ptr = (const unsigned char*)key;
-
-       for (i = 0; i < 4; i++, ptr ++) 
-               ret = (ret << 8) | 
-                       ( ((*ptr >= 'a') &&
-                          (*ptr <= 'z'))? 
-                         *ptr - 'a' + 'A': 
-                         *ptr);
-
-       return ret;
-}
-
 void CtdlRegisterDebugFlagHook(const char *Name, long Len, CtdlDbgFunction F, const int *LogP)
 {
        LogDebugEntry *E;
@@ -1131,7 +1118,7 @@ void CtdlRegisterServiceHook(int tcp_port,
        newfcn->ServiceName = ServiceName;
 
        if (sockpath != NULL) {
-               newfcn->msock = ctdl_uds_server(sockpath, config.c_maxsessions, error);
+               newfcn->msock = ctdl_uds_server(sockpath, CtdlGetConfigInt("c_maxsessions"), error);
                snprintf(message, SIZ, "Unix domain socket '%s': ", sockpath);
        }
        else if (tcp_port <= 0) {       /* port -1 to disable */
@@ -1141,12 +1128,12 @@ void CtdlRegisterServiceHook(int tcp_port,
                return;
        }
        else {
-               newfcn->msock = ctdl_tcp_server(config.c_ip_addr,
+               newfcn->msock = ctdl_tcp_server(CtdlGetConfigStr("c_ip_addr"),
                                              tcp_port,
-                                             config.c_maxsessions
+                                             CtdlGetConfigInt("c_maxsessions")
                                              error);
                snprintf(message, SIZ, "TCP port %s:%d: (%s) ", 
-                        config.c_ip_addr, tcp_port, ServiceName);
+                        CtdlGetConfigStr("c_ip_addr"), tcp_port, ServiceName);
        }
 
        if (newfcn->msock > 0) {
@@ -1495,10 +1482,21 @@ void DebugModulesEnable(const int n)
 {
        DebugModules = n;
 }
+void MarkersEnable(const int n)
+{
+       EnableMarkers = n;
+}
+void DebugCitadelProtoEnable(const int n)
+{
+       EnableCtlProto = n;
+}
+
 CTDL_MODULE_INIT(modules)
 {
        if (!threading) {
                CtdlRegisterDebugFlagHook(HKEY("modules"), DebugModulesEnable, &DebugModules);
+               CtdlRegisterDebugFlagHook(HKEY("periodicmarkers"), MarkersEnable, &EnableMarkers);
+               CtdlRegisterDebugFlagHook(HKEY("citadelprotocol"), DebugCitadelProtoEnable, &EnableCtlProto);
        }
        return "modules";
 }