summaryrefslogtreecommitdiff
path: root/accel-pppd
diff options
context:
space:
mode:
authorKozlov Dmitry <xeb@mail.ru>2012-01-16 17:38:11 +0400
committerKozlov Dmitry <xeb@mail.ru>2012-01-16 17:38:11 +0400
commitc3633b1ab2bcd9d3855a88d435378aaa3c14ead9 (patch)
tree7a49965f23a1da0fa2290a4c5c16a62b734e4e60 /accel-pppd
parentbf1ccc7f6e7a9dc5a8ba3d8d02b25ad446458840 (diff)
downloadaccel-ppp-c3633b1ab2bcd9d3855a88d435378aaa3c14ead9.tar.gz
accel-ppp-c3633b1ab2bcd9d3855a88d435378aaa3c14ead9.zip
core: fix context unregister bug
Diffstat (limited to 'accel-pppd')
-rw-r--r--accel-pppd/log.c2
-rw-r--r--accel-pppd/triton/triton.c7
2 files changed, 8 insertions, 1 deletions
diff --git a/accel-pppd/log.c b/accel-pppd/log.c
index e1dd6d06..43e98a97 100644
--- a/accel-pppd/log.c
+++ b/accel-pppd/log.c
@@ -163,6 +163,8 @@ void __export log_debug(const char *fmt,...)
void __export log_debug2(const char *fmt,...)
{
va_list ap;
+ if (!debug_file)
+ return;
va_start(ap, fmt);
vfprintf(debug_file, fmt, ap);
va_end(ap);
diff --git a/accel-pppd/triton/triton.c b/accel-pppd/triton/triton.c
index 66c6cef5..d806231a 100644
--- a/accel-pppd/triton/triton.c
+++ b/accel-pppd/triton/triton.c
@@ -168,11 +168,11 @@ cont:
goto cont;
}
thread->ctx->thread = NULL;
+
spin_unlock(&thread->ctx->lock);
if (thread->ctx->need_free) {
log_debug2("- context %p removed\n", thread->ctx);
- thread->ctx->ud->tpd = NULL;
mempool_free(thread->ctx);
}
@@ -349,20 +349,25 @@ void __export triton_context_unregister(struct triton_context_t *ud)
}
abort();
}
+
if (!list_empty(&ctx->pending_handlers)) {
triton_log_error("BUG:ctx:triton_unregister_ctx: pending_handlers is not empty");
abort();
}
+
if (!list_empty(&ctx->timers)) {
triton_log_error("BUG:ctx:triton_unregister_ctx: timers is not empty");
abort();
}
+
if (!list_empty(&ctx->pending_timers)) {
triton_log_error("BUG:ctx:triton_unregister_ctx: pending_timers is not empty");
abort();
}
ctx->need_free = 1;
+ ud->tpd = NULL;
+
spin_lock(&ctx_list_lock);
list_del(&ctx->entry);
if (__sync_sub_and_fetch(&triton_stat.context_count, 1) == 1) {