#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/socket.h>
+#include <syslog.h>
#include <sys/syslog.h>
#if TIME_WITH_SYS_TIME
sin.sin_addr.s_addr = inet_addr(ip_addr);
}
- if (sin.sin_addr.s_addr == INADDR_NONE) {
+ if (sin.sin_addr.s_addr == !INADDR_ANY) {
sin.sin_addr.s_addr = INADDR_ANY;
}
void sysdep_master_cleanup(void) {
struct ServiceFunctionHook *serviceptr;
+///// DestroyWorkerList();
/*
* close all protocol master sockets
*/
#ifdef HAVE_OPENSSL
destruct_ssl();
#endif
+ serv_calendar_destroy();
CtdlDestroyProtoHooks();
CtdlDestroyDeleteHooks();
CtdlDestroyXmsgHooks();
CtdlDestroyFixedOutputHooks();
CtdlDestroySessionHooks();
CtdlDestroyServiceHook();
- DestroyWorkerList();
}
else {
fp = fopen(file_pid_file, "w");
if (fp != NULL) {
- fprintf(fp, "%d\n", child);
+ fprintf(fp, ""F_PID_T"\n", child);
fclose(fp);
}
waitpid(current_child, &status, 0);
void DestroyWorkerList(void)
{
+ struct CitContext *ptr; /* general-purpose utility pointer */
+ struct CitContext *rem = NULL; /* list of sessions to be destroyed */
+
+ begin_critical_section(S_SESSION_TABLE);
+ ptr = ContextList;
+ while (ptr != NULL){
+ /* Remove the session from the active list */
+ rem = ptr->next;
+ --num_sessions;
+
+ lprintf(CTDL_DEBUG, "Purging session %d\n", rem->cs_pid);
+ end_critical_section(S_SESSION_TABLE);
+ RemoveContext(ptr);
+ begin_critical_section(S_SESSION_TABLE);
+ free (ptr);
+ ptr = rem;
+ }
+ end_critical_section(S_SESSION_TABLE);
+
struct worker_node *cur, *p;
cur = worker_list;
while (cur != NULL)
lprintf(CTDL_ALERT, "Can't create thread: %s\n", strerror(ret));
}
+ lprintf(CTDL_NOTICE, "Spawned indexer (%ld) and checkpoint (%ld) thread. \n",
+ indexer_thread_tid, checkpoint_thread_tid);
pthread_attr_destroy(&attr);
}