summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKozlov Dmitry <dima@server>2010-11-29 10:52:03 +0300
committerKozlov Dmitry <dima@server>2010-11-29 10:52:03 +0300
commit83283bf5a1704714cd849626845b75abc0378217 (patch)
tree70c7b53d5a7990d9c2d5c82ce4d0ed9a161badfe
parentc5c87c41e79085e2c24999804e9076435e03f4f9 (diff)
parentb414b2026ca90c5b8d7015ccde4f8fafb2558b2d (diff)
downloadaccel-ppp-83283bf5a1704714cd849626845b75abc0378217.tar.gz
accel-ppp-83283bf5a1704714cd849626845b75abc0378217.zip
Merge branch 'master' of ssh://accel-pptp.git.sourceforge.net/gitroot/accel-pptp/accel-pptp
-rw-r--r--accel-pptpd/logs/log_tcp.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/accel-pptpd/logs/log_tcp.c b/accel-pptpd/logs/log_tcp.c
index fdef63e..98b8a41 100644
--- a/accel-pptpd/logs/log_tcp.c
+++ b/accel-pptpd/logs/log_tcp.c
@@ -43,6 +43,8 @@ static const char* level_name[]={" msg", "error", " warn", " info", "debug"};
static void start_connect(struct tcp_target_t *t);
+static LIST_HEAD(targets);
+
static void disconnect(struct tcp_target_t *t)
{
triton_md_unregister_handler(&t->hnd);
@@ -226,6 +228,25 @@ static void start_connect(struct tcp_target_t *t)
triton_md_enable_handler(&t->hnd, MD_MODE_WRITE);
}
+static void log_tcp_close(struct triton_context_t *ctx)
+{
+ struct tcp_target_t *t;
+
+ while (!list_empty(&targets)) {
+ t = list_entry(targets.next, typeof(*t), entry);
+ list_del(&t->entry);
+ if (t->conn_timer.tpd)
+ triton_timer_del(&t->conn_timer);
+ else {
+ t->connected = 0;
+ triton_md_unregister_handler(&t->hnd);
+ close(t->hnd.fd);
+ }
+ }
+
+ triton_context_unregister(&tcp_ctx);
+}
+
static int start_log(const char *_opt)
{
struct tcp_target_t *t;
@@ -266,6 +287,8 @@ static int start_log(const char *_opt)
log_register_target(&t->target);
+ list_add_tail(&t->entry, &targets);
+
return 0;
err:
@@ -273,6 +296,10 @@ err:
return -1;
}
+static struct triton_context_t tcp_ctx ={
+ .close = log_tcp_close,
+};
+
static void __init init(void)
{
struct conf_sect_t *s = conf_get_section("log");