Eliminated all destructor hooks. The operating system can clean this up for us bette...
authorArt Cancro <ajc@citadel.org>
Sun, 24 Jan 2021 00:18:03 +0000 (19:18 -0500)
committerArt Cancro <ajc@citadel.org>
Sun, 24 Jan 2021 00:18:03 +0000 (19:18 -0500)
citadel/serv_extensions.c
citadel/serv_extensions.h
citadel/sysdep.c

index 7c16b6e0af37c9c9097822fef629186668304411..3c62694c04706039b3a4ad503fb707e018f96f94 100644 (file)
@@ -277,12 +277,6 @@ void CtdlRegisterProtoHook(void (*handler) (char *), char *cmd, char *desc)
        syslog(LOG_DEBUG, "extensions: registered server command %s (%s)", cmd, desc);
 }
 
-void CtdlDestroyProtoHooks(void)
-{
-
-       DeleteHash(&ProtoHookList);
-}
-
 
 void CtdlRegisterCleanupHook(void (*fcn_ptr) (void))
 {
@@ -328,21 +322,6 @@ void CtdlUnregisterCleanupHook(void (*fcn_ptr) (void))
 }
 
 
-void CtdlDestroyCleanupHooks(void)
-{
-       CleanupFunctionHook *cur, *p;
-
-       cur = CleanupHookTable;
-       while (cur != NULL)
-       {
-               syslog(LOG_DEBUG, "extensions: destroyed cleanup function");
-               p = cur->next;
-               free(cur);
-               cur = p;
-       }
-       CleanupHookTable = NULL;
-}
-
 void CtdlRegisterEVCleanupHook(void (*fcn_ptr) (void))
 {
 
@@ -387,25 +366,6 @@ void CtdlUnregisterEVCleanupHook(void (*fcn_ptr) (void))
 }
 
 
-void CtdlDestroyEVCleanupHooks(void)
-{
-       CleanupFunctionHook *cur, *p;
-
-       cur = EVCleanupHookTable;
-       while (cur != NULL)
-       {
-               syslog(LOG_DEBUG, "extensions: destroyed cleanup function");
-               p = cur->next;
-               cur->h_function_pointer();
-               free(cur);
-               cur = p;
-       }
-       EVCleanupHookTable = NULL;
-}
-
-
-
-
 void CtdlRegisterSessionHook(void (*fcn_ptr) (void), int EventType, int Priority)
 {
        SessionFunctionHook *newfcn;
@@ -458,21 +418,6 @@ void CtdlUnregisterSessionHook(void (*fcn_ptr) (void), int EventType)
        }
 }
 
-void CtdlDestroySessionHooks(void)
-{
-       SessionFunctionHook *cur, *p;
-
-       cur = SessionHookTable;
-       while (cur != NULL)
-       {
-               syslog(LOG_DEBUG, "extensions: destroyed session function");
-               p = cur->next;
-               free(cur);
-               cur = p;
-       }
-       SessionHookTable = NULL;
-}
-
 
 void CtdlRegisterUserHook(void (*fcn_ptr) (ctdluser *), int EventType)
 {
@@ -519,21 +464,6 @@ void CtdlUnregisterUserHook(void (*fcn_ptr) (struct ctdluser *), int EventType)
        }
 }
 
-void CtdlDestroyUserHooks(void)
-{
-       UserFunctionHook *cur, *p;
-
-       cur = UserHookTable;
-       while (cur != NULL)
-       {
-               syslog(LOG_DEBUG, "extensions: destroyed user function");
-               p = cur->next;
-               free(cur);
-               cur = p;
-       }
-       UserHookTable = NULL;
-}
-
 
 void CtdlRegisterMessageHook(int (*handler)(struct CtdlMessage *, recptypes *), int EventType)
 {
@@ -578,21 +508,6 @@ void CtdlUnregisterMessageHook(int (*handler)(struct CtdlMessage *, recptypes *)
        }
 }
 
-void CtdlDestroyMessageHook(void)
-{
-       MessageFunctionHook *cur, *p;
-
-       cur = MessageHookTable; 
-       while (cur != NULL)
-       {
-               syslog(LOG_DEBUG, "extensions: destroyed message function (type %d)", cur->eventtype);
-               p = cur->next;
-               free(cur);
-               cur = p;
-       }
-       MessageHookTable = NULL;
-}
-
 
 void CtdlRegisterRoomHook(int (*fcn_ptr)(struct ctdlroom *))
 {
@@ -636,22 +551,6 @@ void CtdlUnregisterRoomHook(int (*fcn_ptr)(struct ctdlroom *))
 }
 
 
-void CtdlDestroyRoomHooks(void)
-{
-       RoomFunctionHook *cur, *p;
-
-       cur = RoomHookTable;
-       while (cur != NULL)
-       {
-               syslog(LOG_DEBUG, "extensions: destroyed room function");
-               p = cur->next;
-               free(cur);
-               cur = p;
-       }
-       RoomHookTable = NULL;
-}
-
-
 void CtdlRegisterDeleteHook(void (*handler)(char *, long) )
 {
        DeleteFunctionHook *newfcn;
@@ -694,22 +593,6 @@ void CtdlUnregisterDeleteHook(void (*handler)(char *, long) )
 }
 
 
-void CtdlDestroyDeleteHooks(void)
-{
-       DeleteFunctionHook *cur, *p;
-
-       cur = DeleteHookTable;
-       while (cur != NULL)
-       {
-               syslog(LOG_DEBUG, "extensions: destroyed delete function");
-               p = cur->next;
-               free(cur);
-               cur = p;                
-       }
-       DeleteHookTable = NULL;
-}
-
-
 void CtdlRegisterFixedOutputHook(char *content_type, void (*handler)(char *, int) )
 {
        FixedOutputHook *newfcn;
@@ -753,21 +636,6 @@ void CtdlUnregisterFixedOutputHook(char *content_type)
        }
 }
 
-void CtdlDestroyFixedOutputHooks(void)
-{
-       FixedOutputHook *cur, *p;
-
-       cur = FixedOutputTable; 
-       while (cur != NULL)
-       {
-               syslog(LOG_DEBUG, "extensions: destroyed fixed output function for %s", cur->content_type);
-               p = cur->next;
-               free(cur);
-               cur = p;
-               
-       }
-       FixedOutputTable = NULL;
-}
 
 /* returns nonzero if we found a hook and used it */
 int PerformFixedOutputHooks(char *content_type, char *content, int content_length)
@@ -828,22 +696,6 @@ void CtdlUnregisterXmsgHook(int (*fcn_ptr) (char *, char *, char *, char *), int
 }
 
 
-void CtdlDestroyXmsgHooks(void)
-{
-       XmsgFunctionHook *cur, *p;
-
-       cur = XmsgHookTable;
-       while (cur != NULL)
-       {
-               syslog(LOG_DEBUG, "extensions: destroyed x-msg function (priority %d)", cur->order);
-               p = cur->next;
-               free(cur);
-               cur = p;
-       }
-       XmsgHookTable = NULL;
-}
-
-
 void CtdlRegisterServiceHook(int tcp_port,
                             char *sockpath,
                             void (*h_greeting_function) (void),
@@ -964,39 +816,6 @@ void CtdlShutdownServiceHooks(void)
 }
 
 
-void CtdlDestroyServiceHook(void)
-{
-       const char *Text;
-       ServiceFunctionHook *cur, *p;
-
-       cur = ServiceHookTable;
-       while (cur != NULL)
-       {
-               if (cur->msock != -1)
-               {
-                       close(cur->msock);
-                       Text = "Closed";
-               }
-               else
-               {
-                       Text = " Not closing again";
-               }
-
-               if (cur->sockpath) {
-                       syslog(LOG_INFO, "extensions: %s UNIX domain socket %s", Text, cur->sockpath);
-                       unlink(cur->sockpath);
-               } else if (cur->tcp_port) {
-                       syslog(LOG_INFO, "extensions: %s TCP port %d", Text, cur->tcp_port);
-               } else {
-                       syslog(LOG_INFO, "extensions: destroyed service \"%s\"", cur->ServiceName);
-               }
-               p = cur->next;
-               free(cur);
-               cur = p;
-       }
-       ServiceHookTable = NULL;
-}
-
 void CtdlRegisterSearchFuncHook(void (*fcn_ptr)(int *, long **, const char *), char *name)
 {
        SearchFunctionHook *newfcn;
@@ -1042,18 +861,6 @@ void CtdlUnregisterSearchFuncHook(void (*fcn_ptr)(int *, long **, const char *),
        }
 }
 
-void CtdlDestroySearchHooks(void)
-{
-        SearchFunctionHook *cur, *p;
-
-       cur = SearchFunctionHookTable;
-       SearchFunctionHookTable = NULL;
-        while (cur != NULL) {
-               p = cur->next;
-               free(cur);
-               cur = p;
-       }
-}
 
 void CtdlModuleDoSearch(int *num_msgs, long **search_msgs, const char *search_string, const char *func_name)
 {
index 412b43f0c5a3c0b3f6b200e5aba6cfc5f942f901..cd39831ca8ca08d563ad0bc5f32321058f4f789e 100644 (file)
@@ -32,33 +32,22 @@ void initialize_server_extensions(void);
 int DLoader_Exec_Cmd(char *cmdbuf);
 char *Dynamic_Module_Init(void);
 
-void CtdlDestroySessionHooks(void);
 void PerformSessionHooks(int EventType);
 
-void CtdlDestroyUserHooks(void);
 void PerformUserHooks(struct ctdluser *usbuf, int EventType);
 
 int PerformXmsgHooks(char *, char *, char *, char *);
-void CtdlDestroyXmsgHooks(void);
 
-void CtdlDestroyMessageHook(void);
 int PerformMessageHooks(struct CtdlMessage *, recptypes *recps, int EventType);
 
-void CtdlDestroyRoomHooks(void);
 int PerformRoomHooks(struct ctdlroom *);
 
-void CtdlDestroyDeleteHooks(void);
 void PerformDeleteHooks(char *, long);
 
-void CtdlDestroyCleanupHooks(void);
 
-void CtdlDestroyProtoHooks(void);
 
-void CtdlDestroyServiceHook(void);
 
-void CtdlDestroySearchHooks(void);
 
-void CtdlDestroyFixedOutputHooks(void);
 int PerformFixedOutputHooks(char *, char *, int);
 
 void netcfg_keyname(char *keybuf, long roomnum);
index 1a30b4df769a3dae66824e09d0c27b424aa9fdd1..6da2bb4431e6a1d48eccb9bd71ad61980d310f9c 100644 (file)
@@ -697,25 +697,11 @@ void close_masters (void)
  * The system-dependent part of master_cleanup() - close the master socket.
  */
 void sysdep_master_cleanup(void) {
-       
        close_masters();
-       
        context_cleanup();
-       
 #ifdef HAVE_OPENSSL
        destruct_ssl();
 #endif
-       CtdlDestroyProtoHooks();
-       CtdlDestroyDeleteHooks();
-       CtdlDestroyXmsgHooks();
-       CtdlDestroyUserHooks();
-       CtdlDestroyMessageHook();
-       CtdlDestroyCleanupHooks();
-       CtdlDestroyFixedOutputHooks();  
-       CtdlDestroySessionHooks();
-       CtdlDestroyServiceHook();
-       CtdlDestroyRoomHooks();
-       CtdlDestroySearchHooks();
 }