Changeset 4515 for pjproject


Ignore:
Timestamp:
May 3, 2013 10:32:35 AM (11 years ago)
Author:
nanang
Message:

Fixed #1664: Fixed the bug of unhandled error events in non-connecting socket state in ioqueue epoll.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/src/pj/ioqueue_epoll.c

    r4514 r4515  
    713713            queue[processed].event_type = READABLE_EVENT; 
    714714            ++processed; 
     715            continue; 
    715716        } 
    716717 
     
    726727            queue[processed].event_type = WRITEABLE_EVENT; 
    727728            ++processed; 
     729            continue; 
    728730        } 
    729731 
     
    740742            queue[processed].event_type = WRITEABLE_EVENT; 
    741743            ++processed; 
     744            continue; 
    742745        } 
    743746#endif /* PJ_HAS_TCP */ 
    744          
     747 
    745748        /* 
    746749         * Check for error condition. 
    747750         */ 
    748         if (events[i].events & EPOLLERR && (h->connecting) && !IS_CLOSING(h)) { 
    749                  
    750 #if PJ_IOQUEUE_HAS_SAFE_UNREG 
    751             increment_counter(h); 
    752 #endif           
    753             queue[processed].key = h; 
    754             queue[processed].event_type = EXCEPTION_EVENT; 
    755             ++processed; 
     751        if ((events[i].events & EPOLLERR) && !IS_CLOSING(h)) { 
     752            /* 
     753             * We need to handle this exception event.  If it's related to us 
     754             * connecting, report it as such.  If not, just report it as a 
     755             * read event and the higher layers will handle it. 
     756             */ 
     757            if (h->connecting) { 
     758#if PJ_IOQUEUE_HAS_SAFE_UNREG 
     759                increment_counter(h); 
     760#endif 
     761                queue[processed].key = h; 
     762                queue[processed].event_type = EXCEPTION_EVENT; 
     763                ++processed; 
     764            } else if (!(events[i].events & EPOLLERR) && 
     765                       (key_has_pending_read(h) || key_has_pending_accept(h))) { 
     766#if PJ_IOQUEUE_HAS_SAFE_UNREG 
     767                increment_counter(h); 
     768#endif 
     769                queue[processed].key = h; 
     770                queue[processed].event_type = READABLE_EVENT; 
     771                ++processed; 
     772            } 
     773            continue; 
    756774        } 
    757775    } 
Note: See TracChangeset for help on using the changeset viewer.