Changeset 1519


Ignore:
Timestamp:
Oct 24, 2007 9:37:50 AM (17 years ago)
Author:
bennylp
Message:

Fixed ticket #402: Endless error loop when TCP accept() continuously returns error

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip/sip_transport_tcp.c

    r1476 r1519  
    139139                                pj_status_t status); 
    140140 
     141/* Handle accept() completion */ 
     142static pj_status_t handle_accept(pj_ioqueue_key_t *key,  
     143                                 pj_ioqueue_op_key_t *op_key,  
     144                                 pj_sock_t sock,  
     145                                 pj_status_t status); 
     146 
    141147/* This callback is called by transport manager to destroy listener */ 
    142148static pj_status_t lis_destroy(pjsip_tpfactory *factory); 
     
    359365        listener->accept_op[i]->index = i; 
    360366 
    361         on_accept_complete(listener->key, &listener->accept_op[i]->op_key, 
    362                            listener->sock, PJ_EPENDING); 
     367        status = handle_accept(listener->key, &listener->accept_op[i]->op_key, 
     368                               listener->sock, PJ_EPENDING); 
     369        if (status != PJ_SUCCESS) 
     370            goto on_error; 
    363371    } 
    364372 
     
    903911                                pj_status_t status) 
    904912{ 
     913    handle_accept(key, op_key, sock, status); 
     914} 
     915 
     916 
     917/* Handle accept() completion */ 
     918static pj_status_t handle_accept(pj_ioqueue_key_t *key,  
     919                                 pj_ioqueue_op_key_t *op_key,  
     920                                 pj_sock_t sock,  
     921                                 pj_status_t status) 
     922{ 
    905923    struct tcp_listener *listener; 
    906924    struct tcp_transport *tcp; 
     
    936954             */ 
    937955            ++err_cnt; 
    938             if (err_cnt >= 10) { 
     956            if (err_cnt >= 20) { 
    939957                PJ_LOG(1, (listener->factory.obj_name,  
    940                            "Too many errors, listener stopping")); 
     958                           "Too many errors, LISTENER IS STOPPING!")); 
     959                return status; 
    941960            } 
    942961 
     
    10211040 
    10221041    } while (status != PJ_EPENDING); 
     1042 
     1043    return PJ_SUCCESS; 
    10231044} 
    10241045 
Note: See TracChangeset for help on using the changeset viewer.