Ignore:
Timestamp:
Dec 1, 2006 11:14:37 AM (17 years ago)
Author:
bennylp
Message:

Fixed ticket #29: calling pjsua_init() to reinitialize the whole libraries after pjsua_destroy() is called

File:
1 edited

Legend:

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

    r801 r839  
    282282static pj_status_t init_parser() 
    283283{ 
    284     static int initialized; 
    285284    pj_status_t status; 
    286  
    287     if (initialized) 
    288         return PJ_SUCCESS; 
    289  
    290     initialized = 1; 
    291285 
    292286    /* 
     
    473467void init_sip_parser(void) 
    474468{ 
    475     if (!parser_is_initialized) { 
    476         if (!parser_is_initialized) { 
    477             init_parser(); 
    478             parser_is_initialized = 1; 
    479         } 
    480     } 
     469    pj_enter_critical_section(); 
     470    if (++parser_is_initialized == 1) { 
     471        init_parser(); 
     472    } 
     473    pj_leave_critical_section(); 
     474} 
     475 
     476void deinit_sip_parser(void) 
     477{ 
     478    pj_enter_critical_section(); 
     479    if (--parser_is_initialized == 0) { 
     480        /* Clear header handlers */ 
     481        pj_bzero(handler, sizeof(handler)); 
     482        handler_count = 0; 
     483 
     484        /* Clear URI handlers */ 
     485        pj_bzero(uri_handler, sizeof(uri_handler)); 
     486        uri_handler_count = 0; 
     487    } 
     488    pj_leave_critical_section(); 
    481489} 
    482490 
Note: See TracChangeset for help on using the changeset viewer.