2 * This module handles network mail and mailing list processing.
4 * Copyright (c) 2000-2021 by the citadel.org team
6 * This program is open source software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License, version 3.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * ** NOTE ** A word on the S_NETCONFIGS semaphore:
15 * This is a fairly high-level type of critical section. It ensures that no
16 * two threads work on the netconfigs files at the same time. Since we do
17 * so many things inside these, here are the rules:
18 * 1. begin_critical_section(S_NETCONFIGS) *before* begin_ any others.
19 * 2. Do *not* perform any I/O with the client during these sections.
23 * Duration of time (in seconds) after which pending list subscribe/unsubscribe
24 * requests that have not been confirmed will be deleted.
26 #define EXP 259200 /* three days */
38 #include <sys/types.h>
45 # if HAVE_SYS_SYSCALL_H
46 # include <sys/syscall.h>
53 #include <libcitadel.h>
56 #include "citserver.h"
62 #include "internet_addressing.h"
63 #include "serv_network.h"
64 #include "clientsocket.h"
65 #include "citadel_dirs.h"
68 #include "ctdl_module.h"
72 /* comes from lookup3.c from libcitadel... */
73 extern uint32_t hashlittle( const void *key, size_t length, uint32_t initval);
78 * Run through the rooms doing various types of network stuff.
80 void network_do_queue(void) {
81 static time_t last_run = 0L;
82 int full_processing = 1;
85 * Run the full set of processing tasks no more frequently
86 * than once every n seconds
88 if ( (time(NULL) - last_run) < CtdlGetConfigLong("c_net_freq") ) {
90 syslog(LOG_DEBUG, "network: full processing in %ld seconds.", CtdlGetConfigLong("c_net_freq") - (time(NULL)- last_run));
93 begin_critical_section(S_RPLIST);
94 end_critical_section(S_RPLIST);
97 * Go ahead and run the queue
99 if (full_processing && !server_shutting_down) {
100 syslog(LOG_DEBUG, "network: loading outbound queue");
101 //CtdlForEachNetCfgRoom(network_queue_interesting_rooms, &RL);
102 // FIXME do the outbound crapola AJC 2021
104 syslog(LOG_DEBUG, "network: queue run completed");
106 if (full_processing) {
107 last_run = time(NULL);
115 CTDL_MODULE_INIT(network)
119 CtdlRegisterSessionHook(network_do_queue, EVT_TIMER, PRIO_QUEUE + 10);