Ignore:
Timestamp:
Jan 7, 2006 11:01:13 PM (18 years ago)
Author:
bennylp
Message:

Added prev_state in tsx_state event

File:
1 edited

Legend:

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

    r109 r110  
    254254{ 
    255255    struct loop_transport *loop = arg; 
     256    struct recv_list r; 
     257    struct send_list s; 
     258 
     259    pj_list_init(&r); 
     260    pj_list_init(&s); 
    256261 
    257262    while (!loop->thread_quit_flag) { 
     
    263268        pj_lock_acquire(loop->base.lock); 
    264269 
    265         /* Process pending send notification. */ 
     270        /* Move expired send notification to local list. */ 
    266271        while (!pj_list_empty(&loop->send_list)) { 
    267272            struct send_list *node = loop->send_list.next; 
     
    270275            if (PJ_TIME_VAL_GTE(node->sent_time, now)) 
    271276                break; 
     277 
     278            /* Delete this from the list. */ 
     279            pj_list_erase(node); 
     280 
     281            /* Add to local list. */ 
     282            pj_list_push_back(&s, node); 
     283        } 
     284 
     285        /* Move expired "incoming" packet to local list. */ 
     286        while (!pj_list_empty(&loop->recv_list)) { 
     287            struct recv_list *node = loop->recv_list.next; 
     288 
     289            /* Break when next node time is greater than now. */ 
     290            if (PJ_TIME_VAL_GTE(node->rdata.pkt_info.timestamp, now)) 
     291                break; 
     292 
     293            /* Delete this from the list. */ 
     294            pj_list_erase(node); 
     295 
     296            /* Add to local list. */ 
     297            pj_list_push_back(&r, node); 
     298 
     299        } 
     300 
     301        pj_lock_release(loop->base.lock); 
     302 
     303        /* Process send notification and incoming packet notification 
     304         * without holding down the loop's mutex. 
     305         */ 
     306        while (!pj_list_empty(&s)) { 
     307            struct send_list *node = s.next; 
     308 
     309            pj_list_erase(node); 
    272310 
    273311            /* Notify callback. */ 
     
    276314            } 
    277315 
    278             /* Delete this from the list. */ 
    279             pj_list_erase(node); 
    280  
    281316            /* Decrement tdata reference counter. */ 
    282317            pjsip_tx_data_dec_ref(node->tdata); 
    283318        } 
    284319 
    285         /* Process "incoming" packets. */ 
    286         while (!pj_list_empty(&loop->recv_list)) { 
    287             struct recv_list *node = loop->recv_list.next; 
     320        /* Process "incoming" packet. */ 
     321        while (!pj_list_empty(&r)) { 
     322            struct recv_list *node = r.next; 
    288323            pj_ssize_t size_eaten; 
    289324 
    290             /* Break when next node time is greater than now. */ 
    291             if (PJ_TIME_VAL_GTE(node->rdata.pkt_info.timestamp, now)) 
    292                 break; 
     325            pj_list_erase(node); 
    293326 
    294327            /* Notify transport manager about the "incoming packet" */ 
     
    298331            /* Must "eat" all the packets. */ 
    299332            pj_assert(size_eaten == node->rdata.pkt_info.len); 
    300  
    301             /* Delete this from the list. */ 
    302             pj_list_erase(node); 
    303333 
    304334            /* Done. */ 
     
    306336                                     node->rdata.tp_info.pool); 
    307337        } 
    308  
    309         pj_lock_release(loop->base.lock); 
    310338    } 
    311339 
Note: See TracChangeset for help on using the changeset viewer.