summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorPierre-Yves Ritschard <pyr@cvs.openbsd.org>2007-05-29 00:58:07 +0000
committerPierre-Yves Ritschard <pyr@cvs.openbsd.org>2007-05-29 00:58:07 +0000
commit23eb4d2c3f3016c2268bf9c139061f993f78483b (patch)
tree43132790e3ab083a4d96044ce67757b9fb76e9c9 /usr.sbin
parent32de456d0946e52c50edde609338d43b8387fd44 (diff)
when purging relays, purge sessions as well.
not needed for the initial purge since no sessions exist but will be necessary when reloading the relay process.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/hoststated/hoststated.c7
-rw-r--r--usr.sbin/relayd/relayd.c7
2 files changed, 12 insertions, 2 deletions
diff --git a/usr.sbin/hoststated/hoststated.c b/usr.sbin/hoststated/hoststated.c
index 07d90212c22..f48ba94e18c 100644
--- a/usr.sbin/hoststated/hoststated.c
+++ b/usr.sbin/hoststated/hoststated.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hoststated.c,v 1.25 2007/05/29 00:21:10 pyr Exp $ */
+/* $OpenBSD: hoststated.c,v 1.26 2007/05/29 00:58:06 pyr Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@spootnik.org>
@@ -342,6 +342,7 @@ purge_config(struct hoststated *env, u_int8_t what)
struct protocol *proto;
struct protonode *pnode;
struct relay *rly;
+ struct session *sess;
if (what & PURGE_SERVICES) {
while ((service = TAILQ_FIRST(&env->services)) != NULL) {
@@ -357,6 +358,10 @@ purge_config(struct hoststated *env, u_int8_t what)
if (what & PURGE_RELAYS) {
while ((rly = TAILQ_FIRST(&env->relays)) != NULL) {
TAILQ_REMOVE(&env->relays, rly, entry);
+ while ((sess = TAILQ_FIRST(&rly->sessions)) != NULL) {
+ TAILQ_REMOVE(&rly->sessions, sess, entry);
+ free(sess);
+ }
if (rly->bev != NULL)
bufferevent_free(rly->bev);
if (rly->dstbev != NULL)
diff --git a/usr.sbin/relayd/relayd.c b/usr.sbin/relayd/relayd.c
index 94a938c74ea..9f20b1a90b1 100644
--- a/usr.sbin/relayd/relayd.c
+++ b/usr.sbin/relayd/relayd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: relayd.c,v 1.25 2007/05/29 00:21:10 pyr Exp $ */
+/* $OpenBSD: relayd.c,v 1.26 2007/05/29 00:58:06 pyr Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@spootnik.org>
@@ -342,6 +342,7 @@ purge_config(struct hoststated *env, u_int8_t what)
struct protocol *proto;
struct protonode *pnode;
struct relay *rly;
+ struct session *sess;
if (what & PURGE_SERVICES) {
while ((service = TAILQ_FIRST(&env->services)) != NULL) {
@@ -357,6 +358,10 @@ purge_config(struct hoststated *env, u_int8_t what)
if (what & PURGE_RELAYS) {
while ((rly = TAILQ_FIRST(&env->relays)) != NULL) {
TAILQ_REMOVE(&env->relays, rly, entry);
+ while ((sess = TAILQ_FIRST(&rly->sessions)) != NULL) {
+ TAILQ_REMOVE(&rly->sessions, sess, entry);
+ free(sess);
+ }
if (rly->bev != NULL)
bufferevent_free(rly->bev);
if (rly->dstbev != NULL)