From 5bac5a2edb7bc7639c853fd0f7109dcddb7c4cee Mon Sep 17 00:00:00 2001 From: Kozlov Dmitry Date: Tue, 31 Aug 2010 18:21:14 +0400 Subject: rewriting triton library... --- accel-pptpd/triton/md.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'accel-pptpd/triton/md.c') diff --git a/accel-pptpd/triton/md.c b/accel-pptpd/triton/md.c index 05af432a..3080c5a2 100644 --- a/accel-pptpd/triton/md.c +++ b/accel-pptpd/triton/md.c @@ -6,7 +6,7 @@ #include "triton_p.h" -int max_events=128; +extern int max_events; static int epoll_fd; static struct epoll_event *epoll_events; @@ -16,29 +16,20 @@ static void* md_thread(void *arg) int md_init() { - epoll_fd=epoll_create(0); + epoll_fd=epoll_create(1); if (epoll_fd<0) { perror("epoll_create"); return -1; } - epoll_events=malloc(MAX_EVENTS * sizeof(struct epoll_event)); + epoll_events=malloc(max_events * sizeof(struct epoll_event)); if (!epoll_events) { fprintf(stderr,"cann't allocate memory\n"); return -1; } - default_ctx=malloc(sizeof(*default_ctx)); - if (!default_ctx) - { - fprintf(stderr,"cann't allocate memory\n"); - return -1; - } - - triton_register_ctx(default_ctx); - return 0; } void md_run() @@ -53,11 +44,8 @@ void md_terminate() static void* md_thread(void *arg) { - int max_fd=0,t,r; + int i,n,r; struct triton_md_handler_t *h; - struct timeval tv1,tv2,twait0; - struct list_head *p1,*p2; - int timeout,i,n; n=epoll_wait(epoll_fd,epoll_events,MAX_EVENTS,-1); if (n<0) -- cgit v1.2.3