Changeset 2308
- Timestamp:
- Sep 23, 2008 9:40:11 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/src/pj/ioqueue_epoll.c
r2300 r2308 1 1 /* $Id$ */ 2 2 /* 3 * Copyright (C)2003-200 8Benny Prijono <benny@prijono.org>3 * Copyright (C)2003-2007 Benny Prijono <benny@prijono.org> 4 4 * 5 5 * This program is free software; you can redistribute it and/or modify … … 172 172 173 173 unsigned max, count; 174 pj_ioqueue_key_t hlist; 174 //pj_ioqueue_key_t hlist; 175 pj_ioqueue_key_t active_list; 175 176 int epfd; 176 struct epoll_event *events;177 struct queue *queue;177 //struct epoll_event *events; 178 //struct queue *queue; 178 179 179 180 #if PJ_IOQUEUE_HAS_SAFE_UNREG 180 181 pj_mutex_t *ref_cnt_mutex; 181 pj_ioqueue_key_t active_list;182 182 pj_ioqueue_key_t closing_list; 183 183 pj_ioqueue_key_t free_list; … … 235 235 ioqueue->max = max_fd; 236 236 ioqueue->count = 0; 237 pj_list_init(&ioqueue-> hlist);237 pj_list_init(&ioqueue->active_list); 238 238 239 239 #if PJ_IOQUEUE_HAS_SAFE_UNREG … … 254 254 pj_list_init(&ioqueue->free_list); 255 255 pj_list_init(&ioqueue->closing_list); 256 pj_list_init(&ioqueue->active_list);257 256 258 257 … … 292 291 } 293 292 294 ioqueue->events = pj_pool_calloc(pool, max_fd, sizeof(struct epoll_event));293 /*ioqueue->events = pj_pool_calloc(pool, max_fd, sizeof(struct epoll_event)); 295 294 PJ_ASSERT_RETURN(ioqueue->events != NULL, PJ_ENOMEM); 296 295 297 296 ioqueue->queue = pj_pool_calloc(pool, max_fd, sizeof(struct queue)); 298 297 PJ_ASSERT_RETURN(ioqueue->queue != NULL, PJ_ENOMEM); 299 298 */ 300 299 PJ_LOG(4, ("pjlib", "epoll I/O Queue created (%p)", ioqueue)); 301 300 … … 432 431 433 432 /* Register */ 434 pj_list_insert_before(&ioqueue-> hlist, key);433 pj_list_insert_before(&ioqueue->active_list, key); 435 434 ++ioqueue->count; 436 435 … … 608 607 int i, count, processed; 609 608 int msec; 610 struct epoll_event *events = ioqueue->events; 611 struct queue *queue = ioqueue->queue; 609 //struct epoll_event *events = ioqueue->events; 610 //struct queue *queue = ioqueue->queue; 611 struct epoll_event events[PJ_IOQUEUE_MAX_EVENTS_IN_SINGLE_POLL]; 612 struct queue queue[PJ_IOQUEUE_MAX_EVENTS_IN_SINGLE_POLL]; 612 613 pj_timestamp t1, t2; 613 614 … … 619 620 pj_get_timestamp(&t1); 620 621 621 count = os_epoll_wait( ioqueue->epfd, events, ioqueue->max, msec); 622 //count = os_epoll_wait( ioqueue->epfd, events, ioqueue->max, msec); 623 count = os_epoll_wait( ioqueue->epfd, events, PJ_IOQUEUE_MAX_EVENTS_IN_SINGLE_POLL, msec); 622 624 if (count == 0) { 623 625 #if PJ_IOQUEUE_HAS_SAFE_UNREG … … 656 658 */ 657 659 if ((events[i].events & EPOLLIN) && 658 (key_has_pending_read(h) || key_has_pending_accept(h)) ) {660 (key_has_pending_read(h) || key_has_pending_accept(h)) && !IS_CLOSING(h) ) { 659 661 660 662 #if PJ_IOQUEUE_HAS_SAFE_UNREG … … 669 671 * Check for writeability. 670 672 */ 671 if ((events[i].events & EPOLLOUT) && key_has_pending_write(h) ) {673 if ((events[i].events & EPOLLOUT) && key_has_pending_write(h) && !IS_CLOSING(h)) { 672 674 673 675 #if PJ_IOQUEUE_HAS_SAFE_UNREG … … 683 685 * Check for completion of connect() operation. 684 686 */ 685 if ((events[i].events & EPOLLOUT) && (h->connecting) ) {687 if ((events[i].events & EPOLLOUT) && (h->connecting) && !IS_CLOSING(h)) { 686 688 687 689 #if PJ_IOQUEUE_HAS_SAFE_UNREG … … 697 699 * Check for error condition. 698 700 */ 699 if (events[i].events & EPOLLERR && (h->connecting) ) {701 if (events[i].events & EPOLLERR && (h->connecting) && !IS_CLOSING(h)) { 700 702 701 703 #if PJ_IOQUEUE_HAS_SAFE_UNREG
Note: See TracChangeset
for help on using the changeset viewer.