MODULES: add priorities in execution
authorWilfried Goesgens <dothebart@citadel.org>
Fri, 22 Jun 2012 21:28:52 +0000 (23:28 +0200)
committerWilfried Goesgens <dothebart@citadel.org>
Fri, 22 Jun 2012 21:28:52 +0000 (23:28 +0200)
  - specialy the EV_TIMER callbacks were suffering from wrong order execution which caused bad behaviours:
    - network queueing now is executed before mail queue handling -> mailinglist posts are sent in < 60s instead of < 120s as before
    - network spool consolidation is done before running the citadel networkers; that way the NTT-list won't be locked by running networkers

26 files changed:
citadel/include/ctdl_module.h
citadel/modules/calendar/serv_calendar.c
citadel/modules/checkpoint/serv_checkpoint.c
citadel/modules/crypto/serv_crypto.c
citadel/modules/expire/serv_expire.c
citadel/modules/extnotify/extnotify_main.c
citadel/modules/fulltext/serv_fulltext.c
citadel/modules/imap/serv_imap.c
citadel/modules/instmsg/serv_instmsg.c
citadel/modules/managesieve/serv_managesieve.c
citadel/modules/network/serv_network.c
citadel/modules/network/serv_networkclient.c
citadel/modules/newuser/serv_newuser.c
citadel/modules/openid/serv_openid_rp.c
citadel/modules/pop3/serv_pop3.c
citadel/modules/pop3client/serv_pop3client.c
citadel/modules/roomchat/serv_roomchat.c
citadel/modules/rssclient/serv_rssclient.c
citadel/modules/sieve/serv_sieve.c
citadel/modules/smtp/serv_smtp.c
citadel/modules/smtp/serv_smtpqueue.c
citadel/modules/test/serv_test.c
citadel/modules/vcard/serv_vcard.c
citadel/modules/xmpp/serv_xmpp.c
citadel/serv_extensions.c
citadel/server_main.c

index 9bcdb34a5df49cd004b81c381971756ed5798062..9b7f8e2f96ae460f671a8cddfb8c39561987abfb 100644 (file)
 /*
  * Hook functions available to modules.
  */
-
-void CtdlRegisterSessionHook(void (*fcn_ptr)(void), int EventType);
+/* Priorities for  */
+#define PRIO_QUEUE 500
+#define PRIO_AGGR 1000
+#define PRIO_SEND 1500
+#define PRIO_CLEANUP 2000
+/* Priorities for EVT_HOUSE */
+#define PRIO_HOUSE 3000
+/* Priorities for EVT_LOGIN */
+#define PRIO_CREATE 10000
+/* Priorities for EVT_LOGOUT */
+#define PRIO_LOGOUT 15000
+/* Priorities for EVT_LOGIN */
+#define PRIO_LOGIN 20000
+/* Priorities for EVT_START */
+#define PRIO_START 25000
+/* Priorities for EVT_STOP */
+#define PRIO_STOP 30000
+/* Priorities for EVT_ASYNC */
+#define PRIO_ASYNC 35000
+/* Priorities for EVT_SHUTDOWN */
+#define PRIO_SHUTDOWN 40000
+/* Priorities for EVT_UNSTEALTH */
+#define PRIO_UNSTEALTH 45000
+/* Priorities for EVT_STEALTH */
+#define PRIO_STEALTH 50000
+void CtdlRegisterSessionHook(void (*fcn_ptr)(void), int EventType, int Priority);
 void CtdlUnregisterSessionHook(void (*fcn_ptr)(void), int EventType);
 void CtdlShutdownServiceHooks(void);
 
index 6f8e3feb58289c25f7d6510c86050d333c0302d7..d9236bd33c74111f7a6b7c258e8f5dfbec8d7bfd 100644 (file)
@@ -2600,10 +2600,10 @@ CTDL_MODULE_INIT(calendar)
                /* Initialize our hook functions */
                CtdlRegisterMessageHook(ical_obj_beforesave, EVT_BEFORESAVE);
                CtdlRegisterMessageHook(ical_obj_aftersave, EVT_AFTERSAVE);
-               CtdlRegisterSessionHook(ical_CtdlCreateRoom, EVT_LOGIN);
+               CtdlRegisterSessionHook(ical_CtdlCreateRoom, EVT_LOGIN, PRIO_LOGIN + 1);
                CtdlRegisterProtoHook(cmd_ical, "ICAL", "Citadel iCal commands");
-               CtdlRegisterSessionHook(ical_session_startup, EVT_START);
-               CtdlRegisterSessionHook(ical_session_shutdown, EVT_STOP);
+               CtdlRegisterSessionHook(ical_session_startup, EVT_START, PRIO_START + 1);
+               CtdlRegisterSessionHook(ical_session_shutdown, EVT_STOP, PRIO_STOP + 80);
                CtdlRegisterFixedOutputHook("text/calendar", ical_fixed_output);
                CtdlRegisterFixedOutputHook("application/ics", ical_fixed_output);
                CtdlRegisterCleanupHook(serv_calendar_destroy);
index ba51abd4400b6f486ce39d09c2f4b5a47c99368f..60e829c7deb2b7019372331e596d3feabe0b0fee 100644 (file)
@@ -61,7 +61,7 @@
 CTDL_MODULE_INIT(checkpoint) {
        if (threading)
        {
-               CtdlRegisterSessionHook(cdb_checkpoint, EVT_TIMER);
+               CtdlRegisterSessionHook(cdb_checkpoint, EVT_TIMER, PRIO_CLEANUP + 10);
        }
        /* return our module name for the log */
        return "checkpoint";
index ea542821912b1244f53ee394e1d50c36f575c471..a9761a549e6adf267786151fcb617581686284fb 100644 (file)
@@ -385,7 +385,7 @@ void init_ssl(void)
        CtdlRegisterProtoHook(cmd_stls, "STLS", "Start SSL/TLS session");
        CtdlRegisterProtoHook(cmd_gtls, "GTLS",
                              "Get SSL/TLS session status");
-       CtdlRegisterSessionHook(endtls, EVT_STOP);
+       CtdlRegisterSessionHook(endtls, EVT_STOP, PRIO_STOP + 10);
 }
 
 
index d81880858f9a3ad648e18f0140c30286223dde2e..e03d43b6adc6b7ac386d28f1199111fbb9e53178 100644 (file)
@@ -951,7 +951,7 @@ CTDL_MODULE_INIT(expire)
                CtdlRegisterProtoHook(cmd_tdap, "TDAP", "Manually initiate auto-purger");
                CtdlRegisterProtoHook(cmd_gpex, "GPEX", "Get expire policy");
                CtdlRegisterProtoHook(cmd_spex, "SPEX", "Set expire policy");
-               CtdlRegisterSessionHook(purge_databases, EVT_TIMER);
+               CtdlRegisterSessionHook(purge_databases, EVT_TIMER, PRIO_CLEANUP + 20);
        }
 
        /* return our module name for the log */
index 8d99f6f1cc6f170ddcfbd00d194c598501485e21..a519548faee6271acc0b03252c6e7d1f82544115 100644 (file)
@@ -471,7 +471,7 @@ CTDL_MODULE_INIT(extnotify)
        if (!threading)
        {
                create_extnotify_queue();
-               CtdlRegisterSessionHook(do_extnotify_queue, EVT_TIMER);
+               CtdlRegisterSessionHook(do_extnotify_queue, EVT_TIMER, PRIO_SEND + 10);
        }
        /* return our module name for the log */
        return "extnotify";
index cc3906867981e6154ec43d1fc93b586cec0f212d..b0e3d5e7b3941b3c6eed1e0bac68155879a5506a 100644 (file)
@@ -507,7 +507,7 @@ CTDL_MODULE_INIT(fulltext)
                CtdlRegisterDeleteHook(ft_delete_remove);
                CtdlRegisterSearchFuncHook(ft_search, "fulltext");
                CtdlRegisterCleanupHook(noise_word_cleanup);
-               CtdlRegisterSessionHook(do_fulltext_indexing, EVT_TIMER);
+               CtdlRegisterSessionHook(do_fulltext_indexing, EVT_TIMER, PRIO_CLEANUP + 300);
        }
        /* return our module name for the log */
        return "fulltext";
index 46a6ba7d94591183cc231dfade9ee22db3183649..a7b80d989b3c7b9e94e254adff87c002a273673a 100644 (file)
@@ -1721,7 +1721,7 @@ CTDL_MODULE_INIT(imap)
                CtdlRegisterServiceHook(config.c_imaps_port,
                                        NULL, imaps_greeting, imap_command_loop, NULL, CitadelServiceIMAPS);
 #endif
-               CtdlRegisterSessionHook(imap_cleanup_function, EVT_STOP);
+               CtdlRegisterSessionHook(imap_cleanup_function, EVT_STOP, PRIO_STOP + 30);
                CtdlRegisterCleanupHook(imap_cleanup);
        }
        
index 84acbc4f230931baacf74674a50bf825a34c731e..040c1b42edef254d3b9c4b0fbc244336171eb594 100644 (file)
@@ -599,11 +599,11 @@ CTDL_MODULE_INIT(instmsg)
                CtdlRegisterProtoHook(cmd_sexp, "SEXP", "Send an instant message");
                CtdlRegisterProtoHook(cmd_dexp, "DEXP", "Disable instant messages");
                CtdlRegisterProtoHook(cmd_reqt, "REQT", "Request client termination");
-               CtdlRegisterSessionHook(cmd_gexp_async, EVT_ASYNC);
-               CtdlRegisterSessionHook(delete_instant_messages, EVT_STOP);
+               CtdlRegisterSessionHook(cmd_gexp_async, EVT_ASYNC, PRIO_ASYNC + 1);
+               CtdlRegisterSessionHook(delete_instant_messages, EVT_STOP, PRIO_STOP + 1);
                CtdlRegisterXmsgHook(send_instant_message, XMSG_PRI_LOCAL);
-               CtdlRegisterSessionHook(instmsg_timer, EVT_TIMER);
-               CtdlRegisterSessionHook(instmsg_shutdown, EVT_SHUTDOWN);
+               CtdlRegisterSessionHook(instmsg_timer, EVT_TIMER, PRIO_CLEANUP + 400);
+               CtdlRegisterSessionHook(instmsg_shutdown, EVT_SHUTDOWN, PRIO_SHUTDOWN + 10);
        }
        
        /* return our module name for the log */
index fe7b5423978e13c45b53833a1fe97bf2c8bd9f54..a256d3debf12d2d7073f0083e580358234f580f4 100644 (file)
@@ -666,7 +666,7 @@ CTDL_MODULE_INIT(managesieve)
                                        managesieve_command_loop,
                                        NULL, 
                                        CitadelServiceManageSieve);
-               CtdlRegisterSessionHook(managesieve_cleanup_function, EVT_STOP);
+               CtdlRegisterSessionHook(managesieve_cleanup_function, EVT_STOP, PRIO_STOP + 30);
        }
        
        /* return our module name for the log */
index 5ab8892a0afa3ff5ae04b73952888800e2974809..a100965c74bd146225638e4e9c0491e46a0ea71b 100644 (file)
@@ -734,12 +734,12 @@ CTDL_MODULE_INIT(network)
        {
                CtdlRegisterDebugFlagHook(HKEY("networktalkingto"), SetNTTDebugEnabled, &NTTDebugEnabled);
                CtdlRegisterCleanupHook(cleanup_nttlist);
-               CtdlRegisterSessionHook(network_cleanup_function, EVT_STOP);
-                CtdlRegisterSessionHook(network_logout_hook, EVT_LOGOUT);
+               CtdlRegisterSessionHook(network_cleanup_function, EVT_STOP, PRIO_STOP + 30);
+                CtdlRegisterSessionHook(network_logout_hook, EVT_LOGOUT, PRIO_LOGOUT + 10);
                CtdlRegisterProtoHook(cmd_nsyn, "NSYN", "Synchronize room to node");
                CtdlRegisterRoomHook(network_room_handler);
                CtdlRegisterCleanupHook(destroy_network_queue_room_locked);
-               CtdlRegisterSessionHook(network_do_queue, EVT_TIMER);
+               CtdlRegisterSessionHook(network_do_queue, EVT_TIMER, PRIO_QUEUE + 10);
        }
        return "network";
 }
index 8ee884619ef2e6cac7d869acc83e90da17e0be6b..d5cf394ea5b5035e62fc3d7e51377d5e1e6ab0c1 100644 (file)
@@ -1043,7 +1043,7 @@ CTDL_MODULE_INIT(network_client)
        {
                CtdlFillSystemContext(&networker_client_CC, "CitNetworker");
                
-               CtdlRegisterSessionHook(network_do_clientqueue, EVT_TIMER);
+               CtdlRegisterSessionHook(network_do_clientqueue, EVT_TIMER, PRIO_SEND + 10);
                CtdlRegisterDebugFlagHook(HKEY("networkclient"), LogDebugEnableNetworkClient, &NetworkClientDebugEnabled);
 
        }
index 2be9b1a5a46bded6802c689fa0cdbe547d89fe60..64ffc8a287a363c4384687bc659bfdac41ee688b 100644 (file)
@@ -110,7 +110,7 @@ CTDL_MODULE_INIT(newuser)
 {
        if (!threading)
        {
-               CtdlRegisterSessionHook(CopyNewUserGreetings, EVT_LOGIN);
+               CtdlRegisterSessionHook(CopyNewUserGreetings, EVT_LOGIN, PRIO_LOGIN + 1);
        }
        
        /* return our module name for the log */
index 69006e48e2e2b853cfad57fa1ca3d122a32b8ac8..ecb4ef3875eb9c6b6c477224fbb537aa326dcdba 100644 (file)
@@ -1140,7 +1140,7 @@ CTDL_MODULE_INIT(openid_rp)
                        CtdlRegisterProtoHook(cmd_oidc, "OIDC", "Create new user after validating OpenID");
                        CtdlRegisterProtoHook(cmd_oida, "OIDA", "List all OpenIDs in the database");
                }
-               CtdlRegisterSessionHook(openid_cleanup_function, EVT_LOGOUT);
+               CtdlRegisterSessionHook(openid_cleanup_function, EVT_LOGOUT, PRIO_LOGOUT + 10);
                CtdlRegisterUserHook(openid_purge, EVT_PURGEUSER);
                openid_level_supported = 1;     /* This module supports OpenID 1.0 only */
        }
index 3de0bf57d604938947a0e6ff50969985ff928d79..de4d7a0653efb9b7e6b77ce189cbcf239ab16a10 100644 (file)
@@ -679,7 +679,7 @@ CTDL_MODULE_INIT(pop3)
                                        NULL,
                                        CitadelServicePop3S);
 #endif
-               CtdlRegisterSessionHook(pop3_cleanup_function, EVT_STOP);
+               CtdlRegisterSessionHook(pop3_cleanup_function, EVT_STOP, PRIO_STOP + 30);
        }
        
        /* return our module name for the log */
index 599a35e69f396fd994c6621a78cd50f283d0d705..c14e5da730f15ef0f10a3ab6cc1fd71099bec9c4 100644 (file)
@@ -1260,7 +1260,7 @@ CTDL_MODULE_INIT(pop3client)
                pthread_mutex_init(&POP3QueueMutex, NULL);
                POP3QueueRooms = NewHash(1, lFlathash);
                POP3FetchUrls = NewHash(1, NULL);
-               CtdlRegisterSessionHook(pop3client_scan, EVT_TIMER);
+               CtdlRegisterSessionHook(pop3client_scan, EVT_TIMER, PRIO_AGGR + 50);
                CtdlRegisterEVCleanupHook(pop3_cleanup);
                CtdlRegisterDebugFlagHook(HKEY("pop3client"), LogDebugEnablePOP3Client, &POP3ClientDebugEnabled);
        }
index b0a7ccda43234414b596d6a4d9a97284e6c7373e..c153c4f11c192e4bbad0d189b136dc1633bda2ab 100644 (file)
@@ -267,8 +267,8 @@ CTDL_MODULE_INIT(roomchat)
        if (!threading)
        {
                CtdlRegisterProtoHook(cmd_rcht, "RCHT", "Participate in real time chat in a room");
-               CtdlRegisterSessionHook(roomchat_timer, EVT_TIMER);
-               CtdlRegisterSessionHook(roomchat_shutdown, EVT_SHUTDOWN);
+               CtdlRegisterSessionHook(roomchat_timer, EVT_TIMER, PRIO_CLEANUP + 400);
+               CtdlRegisterSessionHook(roomchat_shutdown, EVT_SHUTDOWN, PRIO_SHUTDOWN + 55);
        }
        
        /* return our module name for the log */
index c1e08b81135ed2a4d2613ff67315324a9776448f..7bde9791d857f4ee029d423e7b8bd78abcf9135f 100644 (file)
@@ -592,7 +592,7 @@ CTDL_MODULE_INIT(rssclient)
                RSSQueueRooms = NewHash(1, lFlathash);
                RSSFetchUrls = NewHash(1, NULL);
                syslog(LOG_INFO, "%s\n", curl_version());
-               CtdlRegisterSessionHook(rssclient_scan, EVT_TIMER);
+               CtdlRegisterSessionHook(rssclient_scan, EVT_TIMER, PRIO_AGGR + 300);
                CtdlRegisterEVCleanupHook(rss_cleanup);
                CtdlRegisterDebugFlagHook(HKEY("rssclient"), LogDebugEnableRSSClient, &RSSClientDebugEnabled);
        }
index 7d56d5e0a96842947dafe048f0183b56a6b6d270..abce872ce89660de12afaf7d4962db47d354140a 100644 (file)
@@ -1354,7 +1354,7 @@ CTDL_MODULE_INIT(sieve)
                ctdl_sieve_init();
                CtdlRegisterProtoHook(cmd_msiv, "MSIV", "Manage Sieve scripts");
                CtdlRegisterRoomHook(serv_sieve_room);
-               CtdlRegisterSessionHook(perform_sieve_processing, EVT_HOUSE);
+               CtdlRegisterSessionHook(perform_sieve_processing, EVT_HOUSE, PRIO_HOUSE + 10);
                CtdlRegisterCleanupHook(cleanup_sieve);
        }
        
index d6f8e2a30e72ace82cfa10d1287a976d684a8a6a..cc026916d6258a32f6ca833a89e6e86a8cb08f38 100644 (file)
@@ -961,7 +961,7 @@ CTDL_MODULE_INIT(smtp)
                                        NULL,
                                        CitadelServiceSMTP_LMTP_UNF);
 
-               CtdlRegisterSessionHook(smtp_cleanup_function, EVT_STOP);
+               CtdlRegisterSessionHook(smtp_cleanup_function, EVT_STOP, PRIO_STOP + 250);
        }
        
        /* return our module name for the log */
index 589b13a482156ecdc9de2ba9e1a9fd1f15fe1490..2430d0db8a76f24f2a2cca9fe0815d2331358c8d 100644 (file)
@@ -1137,7 +1137,7 @@ CTDL_MODULE_INIT(smtp_queu)
                CtdlRegisterEVCleanupHook(smtp_evq_cleanup);
 
                CtdlRegisterProtoHook(cmd_smtp, "SMTP", "SMTP utility commands");
-               CtdlRegisterSessionHook(smtp_do_queue, EVT_TIMER);
+               CtdlRegisterSessionHook(smtp_do_queue, EVT_TIMER, PRIO_SEND + 10);
        }
 
        /* return our Subversion id for the Log */
index c82ecb87cdfea14b6850c550783e502577b13d2e..bbb0e54168dd2fc69ae9d6ba2d04b071807ae4b4 100644 (file)
@@ -74,10 +74,10 @@ CTDL_MODULE_INIT(test)
        if (!threading)
        {
                CtdlRegisterCleanupHook(CleanupTest);
-               CtdlRegisterSessionHook(NewRoomTest, EVT_NEWROOM);
-               CtdlRegisterSessionHook(SessionStartTest, EVT_START);
-               CtdlRegisterSessionHook(SessionStopTest, EVT_STOP);
-               CtdlRegisterSessionHook(LoginTest, EVT_LOGIN);
+               CtdlRegisterSessionHook(NewRoomTest, EVT_NEWROOM, 1);
+               CtdlRegisterSessionHook(SessionStartTest, EVT_START, 1);
+               CtdlRegisterSessionHook(SessionStopTest, EVT_STOP, 1);
+               CtdlRegisterSessionHook(LoginTest, EVT_LOGIN, 1);
        }
 #endif
 
index 9505ba1852efd110e7dca1a496878bfa3ccaf0d4..edcbd4cce6bcade7bd3b79d1174188163e120e4a 100644 (file)
@@ -1452,7 +1452,7 @@ CTDL_MODULE_INIT(vcard)
 
        if (!threading)
        {
-               CtdlRegisterSessionHook(vcard_session_login_hook, EVT_LOGIN);
+               CtdlRegisterSessionHook(vcard_session_login_hook, EVT_LOGIN, PRIO_LOGIN + 70);
                CtdlRegisterMessageHook(vcard_upload_beforesave, EVT_BEFORESAVE);
                CtdlRegisterMessageHook(vcard_upload_aftersave, EVT_AFTERSAVE);
                CtdlRegisterDeleteHook(vcard_delete_remove);
@@ -1466,7 +1466,7 @@ CTDL_MODULE_INIT(vcard)
                CtdlRegisterUserHook(vcard_newuser, EVT_NEWUSER);
                CtdlRegisterUserHook(vcard_purge, EVT_PURGEUSER);
                CtdlRegisterNetprocHook(vcard_extract_from_network);
-               CtdlRegisterSessionHook(store_harvested_addresses, EVT_TIMER);
+               CtdlRegisterSessionHook(store_harvested_addresses, EVT_TIMER, PRIO_CLEANUP + 470);
                CtdlRegisterFixedOutputHook("text/x-vcard", vcard_fixed_output);
                CtdlRegisterFixedOutputHook("text/vcard", vcard_fixed_output);
 
index 374c4914277febee7937e90db62bb2708b22ab4e..7d8fbc67d02c3349ec864d3d56e916563962fc50 100644 (file)
@@ -633,11 +633,11 @@ CTDL_MODULE_INIT(xmpp)
                                        CitadelServiceXMPP
                );
                CtdlRegisterDebugFlagHook(HKEY("serv_xmpp"), LogXMPPSrvDebugEnable, &XMPPSrvDebugEnable);
-               CtdlRegisterSessionHook(xmpp_cleanup_function, EVT_STOP);
-                CtdlRegisterSessionHook(xmpp_login_hook, EVT_LOGIN);
-                CtdlRegisterSessionHook(xmpp_logout_hook, EVT_LOGOUT);
-                CtdlRegisterSessionHook(xmpp_login_hook, EVT_UNSTEALTH);
-                CtdlRegisterSessionHook(xmpp_logout_hook, EVT_STEALTH);
+               CtdlRegisterSessionHook(xmpp_cleanup_function, EVT_STOP, PRIO_STOP + 70);
+                CtdlRegisterSessionHook(xmpp_login_hook, EVT_LOGIN, PRIO_LOGIN + 90);
+                CtdlRegisterSessionHook(xmpp_logout_hook, EVT_LOGOUT, PRIO_LOGOUT + 90);
+                CtdlRegisterSessionHook(xmpp_login_hook, EVT_UNSTEALTH, PRIO_UNSTEALTH + 1);
+                CtdlRegisterSessionHook(xmpp_logout_hook, EVT_STEALTH, PRIO_STEALTH + 1);
                CtdlRegisterCleanupHook(xmpp_cleanup_events);
 
        }
index a742c619167297ad82531e253936ac27b363696e..b03741e7a02a90a42c611c412f87c4f03eb18136 100644 (file)
@@ -87,6 +87,7 @@ extern FixedOutputHook *FixedOutputTable;
 typedef struct SessionFunctionHook SessionFunctionHook;
 struct SessionFunctionHook {
        SessionFunctionHook *next;
+       int Priority;
        void (*h_function_pointer) (void);
        int eventtype;
 };
@@ -595,20 +596,28 @@ void CtdlDestroyEVCleanupHooks(void)
 }
 
 
-void CtdlRegisterSessionHook(void (*fcn_ptr) (void), int EventType)
+void CtdlRegisterSessionHook(void (*fcn_ptr) (void), int EventType, int Priority)
 {
-
        SessionFunctionHook *newfcn;
 
        newfcn = (SessionFunctionHook *)
            malloc(sizeof(SessionFunctionHook));
-       newfcn->next = SessionHookTable;
+       newfcn->Priority = Priority;
        newfcn->h_function_pointer = fcn_ptr;
        newfcn->eventtype = EventType;
-       SessionHookTable = newfcn;
 
-       MOD_syslog(LOG_DEBUG, "Registered a new session function (type %d)\n",
-                  EventType);
+       SessionFunctionHook **pfcn;
+       pfcn = &SessionHookTable;
+       while ((*pfcn != NULL) && 
+              ((*pfcn)->Priority < newfcn->Priority) &&
+              ((*pfcn)->next != NULL))
+               pfcn = &(*pfcn)->next;
+               
+       newfcn->next = *pfcn;
+       *pfcn = newfcn;
+       
+       MOD_syslog(LOG_DEBUG, "Registered a new session function (type %d Priority %d)\n",
+                  EventType, Priority);
 }
 
 
index 0dc52a0e4667cd6d320be7f7562cfbf4615bd66a..b0cd8f167b00be70be9f76b5822e4191afd2583d 100644 (file)
@@ -371,7 +371,7 @@ int main(int argc, char **argv)
        }
 
        /* We want to check for idle sessions once per minute */
-       CtdlRegisterSessionHook(terminate_idle_sessions, EVT_TIMER);
+       CtdlRegisterSessionHook(terminate_idle_sessions, EVT_TIMER, PRIO_CLEANUP + 1);
 
        go_threading();