rss client and network modules are now run as scheduled threads.
*
* Run through the rooms doing various types of network stuff.
*/
*
* Run through the rooms doing various types of network stuff.
*/
-void network_do_queue(void) {
+void *network_do_queue(void *args) {
static time_t last_run = 0L;
struct RoomProcList *ptr;
int full_processing = 1;
static time_t last_run = 0L;
struct RoomProcList *ptr;
int full_processing = 1;
* don't really require extremely fine granularity here, we'll do it
* with a static variable instead.
*/
* don't really require extremely fine granularity here, we'll do it
* with a static variable instead.
*/
- if (doing_queue) return;
+ if (doing_queue) return NULL;
doing_queue = 1;
/* Load the IGnet Configuration into memory */
doing_queue = 1;
/* Load the IGnet Configuration into memory */
+ CtdlThreadSchedule("IGnet Network", CTDLTHREAD_BIGSTACK, network_do_queue, NULL, time(NULL) + 60);
+ return NULL;
CtdlRegisterProtoHook(cmd_snet, "SNET", "Set network config");
CtdlRegisterProtoHook(cmd_netp, "NETP", "Identify as network poller");
CtdlRegisterProtoHook(cmd_nsyn, "NSYN", "Synchronize room to node");
CtdlRegisterProtoHook(cmd_snet, "SNET", "Set network config");
CtdlRegisterProtoHook(cmd_netp, "NETP", "Identify as network poller");
CtdlRegisterProtoHook(cmd_nsyn, "NSYN", "Synchronize room to node");
- CtdlRegisterSessionHook(network_do_queue, EVT_TIMER);
+// CtdlRegisterSessionHook(network_do_queue, EVT_TIMER);
CtdlRegisterRoomHook(network_room_handler);
CtdlRegisterCleanupHook(destroy_network_queue_room);
}
CtdlRegisterRoomHook(network_room_handler);
CtdlRegisterCleanupHook(destroy_network_queue_room);
}
+ else
+ CtdlThreadSchedule("IGnet Network", CTDLTHREAD_BIGSTACK, network_do_queue, NULL, 0);
/* return our Subversion id for the Log */
return "$Id$";
}
/* return our Subversion id for the Log */
return "$Id$";
}
/*
* Scan for rooms that have RSS client requests configured
*/
/*
* Scan for rooms that have RSS client requests configured
*/
-void rssclient_scan(void) {
+void *rssclient_scan(void *args) {
static time_t last_run = 0L;
static int doing_rssclient = 0;
struct rssnetcfg *rptr = NULL;
static time_t last_run = 0L;
static int doing_rssclient = 0;
struct rssnetcfg *rptr = NULL;
/*
* Run RSS client no more frequently than once every n seconds
*/
/*
* Run RSS client no more frequently than once every n seconds
*/
- if ( (time(NULL) - last_run) < config.c_net_freq ) {
- return;
- }
+// if ( (time(NULL) - last_run) < config.c_net_freq ) {
+// return;
+// }
/*
* This is a simple concurrency check to make sure only one rssclient run
/*
* This is a simple concurrency check to make sure only one rssclient run
* don't really require extremely fine granularity here, we'll do it
* with a static variable instead.
*/
* don't really require extremely fine granularity here, we'll do it
* with a static variable instead.
*/
- if (doing_rssclient) return;
+ if (doing_rssclient) return NULL;
doing_rssclient = 1;
lprintf(CTDL_DEBUG, "rssclient started\n");
doing_rssclient = 1;
lprintf(CTDL_DEBUG, "rssclient started\n");
lprintf(CTDL_DEBUG, "rssclient ended\n");
last_run = time(NULL);
doing_rssclient = 0;
lprintf(CTDL_DEBUG, "rssclient ended\n");
last_run = time(NULL);
doing_rssclient = 0;
+ CtdlThreadSchedule ("RSS Client", CTDLTHREAD_BIGSTACK, rssclient_scan, NULL, last_run + config.c_net_freq);
+ return NULL;
CTDL_MODULE_INIT(rssclient)
{
CTDL_MODULE_INIT(rssclient)
{
- CtdlRegisterSessionHook(rssclient_scan, EVT_TIMER);
+// CtdlRegisterSessionHook(rssclient_scan, EVT_TIMER);
+ CtdlThreadSchedule ("RSS Client", CTDLTHREAD_BIGSTACK, rssclient_scan, NULL, 0);
#else
lprintf(CTDL_INFO, "This server is missing the Expat XML parser. RSS client will be disabled.\n");
#endif
#else
lprintf(CTDL_INFO, "This server is missing the Expat XML parser. RSS client will be disabled.\n");
#endif