summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2014-05-18 02:17:11 +0000
committerDmitry Kozlov <xeb@mail.ru>2014-05-18 02:17:11 +0000
commitad39c45f1fe5ba4f84c87de6166c55c2c176840c (patch)
tree97bfc319d59b18baa04ece31cf0d95c19442d316
parent6147e4dcef23570b025813f1afe481c34ce07ccc (diff)
parent0b3e64e4b056cf6b17c4bdc45100c11bcc116e8d (diff)
downloadaccel-ppp-xebd-ad39c45f1fe5ba4f84c87de6166c55c2c176840c.tar.gz
accel-ppp-xebd-ad39c45f1fe5ba4f84c87de6166c55c2c176840c.zip
Merge branch 'master' of ssh://git.code.sf.net/p/accel-ppp/code
-rw-r--r--accel-pppd/triton/md.c23
-rw-r--r--accel-pppd/triton/triton_p.h1
2 files changed, 7 insertions, 17 deletions
diff --git a/accel-pppd/triton/md.c b/accel-pppd/triton/md.c
index a7eb5c8..600b968 100644
--- a/accel-pppd/triton/md.c
+++ b/accel-pppd/triton/md.c
@@ -96,23 +96,16 @@ static void *md_thread(void *arg)
if (r)
triton_thread_wakeup(h->ctx->thread);
}
-
- pthread_mutex_lock(&freed_list_lock);
- while (!list_empty(&freed_list)) {
- h = list_entry(freed_list.next, typeof(*h), entry);
- list_move(&h->entry, &freed_list2);
- }
- pthread_mutex_unlock(&freed_list_lock);
while (!list_empty(&freed_list2)) {
h = list_entry(freed_list2.next, typeof(*h), entry);
list_del(&h->entry);
- if (h->fd != -1) {
- r = epoll_ctl(epoll_fd, EPOLL_CTL_DEL, h->fd, NULL);
- close(h->fd);
- }
mempool_free(h);
}
+
+ pthread_mutex_lock(&freed_list_lock);
+ list_splice_init(&freed_list, &freed_list2);
+ pthread_mutex_unlock(&freed_list_lock);
}
return NULL;
@@ -139,14 +132,12 @@ void __export triton_md_register_handler(struct triton_context_t *ctx, struct tr
void __export triton_md_unregister_handler(struct triton_md_handler_t *ud, int c)
{
struct _triton_md_handler_t *h = (struct _triton_md_handler_t *)ud->tpd;
+
triton_md_disable_handler(ud, MD_MODE_READ | MD_MODE_WRITE);
-
+
if (c) {
- h->fd = ud->fd;
+ close(ud->fd);
ud->fd = -1;
- } else {
- triton_md_disable_handler(ud, MD_MODE_READ | MD_MODE_WRITE);
- h->fd = -1;
}
spin_lock(&h->ctx->lock);
diff --git a/accel-pppd/triton/triton_p.h b/accel-pppd/triton/triton_p.h
index d86f1bc..443cede 100644
--- a/accel-pppd/triton/triton_p.h
+++ b/accel-pppd/triton/triton_p.h
@@ -53,7 +53,6 @@ struct _triton_md_handler_t
struct _triton_context_t *ctx;
struct epoll_event epoll_event;
uint32_t trig_epoll_events;
- int fd;
int pending:1;
int trig_level:1;
struct triton_md_handler_t *ud;