summaryrefslogtreecommitdiff
path: root/accel-pptpd/triton
diff options
context:
space:
mode:
authorKozlov Dmitry <dima@server>2010-11-16 17:19:33 +0300
committerKozlov Dmitry <dima@server>2010-11-16 17:19:33 +0300
commite95fc28b08669e329916e1cf1eb52fa462ad655a (patch)
treeb584a8719fc5950ae9f683c6ce865ee074e3e450 /accel-pptpd/triton
parent50881d86b036e3b658c45e56b57b12a60e1562ef (diff)
downloadaccel-ppp-e95fc28b08669e329916e1cf1eb52fa462ad655a.tar.gz
accel-ppp-e95fc28b08669e329916e1cf1eb52fa462ad655a.zip
log-tcp: fixed incorrect queue overflow handling
ppp: fixed memory leak when ipcp raises error at ConfReq
Diffstat (limited to 'accel-pptpd/triton')
-rw-r--r--accel-pptpd/triton/triton.c24
-rw-r--r--accel-pptpd/triton/triton.h1
-rw-r--r--accel-pptpd/triton/triton_p.h1
3 files changed, 16 insertions, 10 deletions
diff --git a/accel-pptpd/triton/triton.c b/accel-pptpd/triton/triton.c
index 597288be..e7855ccf 100644
--- a/accel-pptpd/triton/triton.c
+++ b/accel-pptpd/triton/triton.c
@@ -205,7 +205,10 @@ int triton_queue_ctx(struct _triton_context_t *ctx)
spin_lock(&threads_lock);
if (list_empty(&sleep_threads)) {
- list_add_tail(&ctx->entry2, &ctx_queue);
+ if (ctx->priority)
+ list_add(&ctx->entry2, &ctx_queue);
+ else
+ list_add_tail(&ctx->entry2, &ctx_queue);
spin_unlock(&threads_lock);
ctx->queued = 1;
//printf("ctx %p: queued\n", ctx);
@@ -318,6 +321,13 @@ void __export triton_context_unregister(struct triton_context_t *ud)
}
}
+void __export triton_context_set_priority(struct triton_context_t *ud, int prio)
+{
+ struct _triton_context_t *ctx = (struct _triton_context_t *)ud->tpd;
+
+ ctx->priority = prio > 0;
+}
+
void __export triton_context_schedule(struct triton_context_t *ud)
{
struct _triton_context_t *ctx = (struct _triton_context_t *)ud->tpd;
@@ -333,16 +343,10 @@ void __export triton_context_schedule(struct triton_context_t *ud)
ctx->thread = NULL;
spin_unlock(&ctx->lock);
- while (1) {
- if (swapcontext(&ctx->uctx, uctx)) {
- if (errno == EINTR)
- continue;
- triton_log_error("swaswpntext: %s\n", strerror(errno));
- } else
- break;
- }
-
__sync_fetch_and_add(&triton_stat.context_sleeping, 1);
+
+ if (swapcontext(&ctx->uctx, uctx))
+ triton_log_error("swaswpntext: %s\n", strerror(errno));
}
void triton_context_print(void)
diff --git a/accel-pptpd/triton/triton.h b/accel-pptpd/triton/triton.h
index f494bb39..94254288 100644
--- a/accel-pptpd/triton/triton.h
+++ b/accel-pptpd/triton/triton.h
@@ -68,6 +68,7 @@ struct triton_stat_t
extern struct triton_stat_t triton_stat;
int triton_context_register(struct triton_context_t *, void *arg);
void triton_context_unregister(struct triton_context_t *);
+void triton_context_set_priority(struct triton_context_t *, int);
void triton_context_schedule(struct triton_context_t *);
int triton_context_wakeup(struct triton_context_t *);
int triton_context_call(struct triton_context_t *, void (*func)(void *), void *arg);
diff --git a/accel-pptpd/triton/triton_p.h b/accel-pptpd/triton/triton_p.h
index c685051a..f6fb6789 100644
--- a/accel-pptpd/triton/triton_p.h
+++ b/accel-pptpd/triton/triton_p.h
@@ -44,6 +44,7 @@ struct _triton_context_t
int need_close:1;
int need_free:1;
int pending:1;
+ int priority:1;
struct triton_context_t *ud;
void *bf_arg;