summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/child.c2
-rw-r--r--src/loop.c5
-rw-r--r--src/loop.h1
-rw-r--r--src/main.c4
4 files changed, 10 insertions, 2 deletions
diff --git a/src/child.c b/src/child.c
index 96864b1..b220da3 100644
--- a/src/child.c
+++ b/src/child.c
@@ -91,8 +91,6 @@ void child_main_loop (void)
childs = sblist_new(sizeof (struct child*), config->maxclients);
- loop_records_init();
-
for (i = 0; i < nfds; i++) {
int *fd = (int *) vector_getentry(listen_fds, i, NULL);
fds[i].fd = *fd;
diff --git a/src/loop.c b/src/loop.c
index 77b073d..d696760 100644
--- a/src/loop.c
+++ b/src/loop.c
@@ -18,6 +18,11 @@ void loop_records_init(void) {
loop_records = sblist_new(sizeof (struct loop_record), 32);
}
+void loop_records_destroy(void) {
+ sblist_free(loop_records);
+ loop_records = 0;
+}
+
#if 0
static void su_to_str(union sockaddr_union *addr, char *buf) {
int af = addr->v4.sin_family;
diff --git a/src/loop.h b/src/loop.h
index 19877d3..27a26c7 100644
--- a/src/loop.h
+++ b/src/loop.h
@@ -4,6 +4,7 @@
#include "sock.h"
void loop_records_init(void);
+void loop_records_destroy(void);
void loop_records_add(union sockaddr_union *addr);
int connection_loops (union sockaddr_union *addr);
diff --git a/src/main.c b/src/main.c
index 8bda2b9..b9c264a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -393,6 +393,8 @@ main (int argc, char **argv)
if (daemonized) setup_sig (SIGHUP, takesig, "SIGHUP", argv[0]);
setup_sig (SIGUSR1, takesig, "SIGUSR1", argv[0]);
+ loop_records_init();
+
/* Start the main loop */
log_message (LOG_INFO, "Starting main loop. Accepting connections.");
@@ -404,6 +406,8 @@ main (int argc, char **argv)
child_close_sock ();
child_free_children();
+ loop_records_destroy();
+
/* Remove the PID file */
if (config->pidpath != NULL && unlink (config->pidpath) < 0) {
log_message (LOG_WARNING,