Changeset 839


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

Location:
pjproject/trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/include/pj/errno.h

    r745 r839  
    347347PJ_END_DECL 
    348348 
     349/* Internal */ 
     350void pj_errno_clear_handlers(void); 
     351 
    349352#endif  /* __PJ_ERRNO_H__ */ 
    350353 
  • pjproject/trunk/pjlib/src/pj/config.c

    r835 r839  
    2222 
    2323static const char *id = "config.c"; 
    24 const char *PJ_VERSION = "0.5.9"; 
     24const char *PJ_VERSION = "0.5.9.1"; 
    2525 
    2626PJ_DEF(void) pj_dump_config(void) 
  • pjproject/trunk/pjlib/src/pj/errno.c

    r745 r839  
    134134} 
    135135 
     136/* Internal PJLIB function called by pj_shutdown() to clear error handlers */ 
     137void pj_errno_clear_handlers(void) 
     138{ 
     139    err_msg_hnd_cnt = 0; 
     140    pj_bzero(err_msg_hnd, sizeof(err_msg_hnd)); 
     141} 
     142 
     143 
    136144/* 
    137145 * pj_strerror() 
  • pjproject/trunk/pjlib/src/pj/except.c

    r815 r839  
    5858        thread_local_id = -1; 
    5959    } 
     60 
     61#if defined(PJ_HAS_EXCEPTION_NAMES) && PJ_HAS_EXCEPTION_NAMES != 0 
     62    { 
     63        unsigned i; 
     64        for (i=0; i<PJ_MAX_EXCEPTION_ID; ++i) 
     65            exception_id_names[i] = NULL; 
     66    } 
     67#else 
     68    last_exception_id = 1; 
     69#endif 
    6070} 
    6171 
  • pjproject/trunk/pjlib/src/pj/os_core_unix.c

    r816 r839  
    208208    } 
    209209#endif 
     210 
     211    /* Clear static variables */ 
     212    pj_errno_clear_handlers(); 
    210213} 
    211214 
  • pjproject/trunk/pjlib/src/pj/os_core_win32.c

    r821 r839  
    219219    } 
    220220 
     221    /* Clear static variables */ 
     222    pj_errno_clear_handlers(); 
     223 
    221224    /* Shutdown Winsock */ 
    222225    //WSACleanup(); 
  • pjproject/trunk/pjlib/src/pj/pool_buf.c

    r815 r839  
    3939        tls = -1; 
    4040    } 
     41    if (is_initialized) 
     42        is_initialized = 0; 
    4143} 
    4244 
  • pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c

    r832 r839  
    362362 
    363363    /* Run pj_getopt once to see if user specifies config file to read. */  
     364    pj_optind = 0; 
    364365    while ((c=pj_getopt_long(argc, argv, "", long_options,  
    365366                             &option_index)) != -1)  
     
    28462847pj_status_t app_destroy(void) 
    28472848{ 
     2849    pj_status_t status; 
     2850 
    28482851#ifdef STEREO_DEMO 
    28492852    if (app_config.snd) { 
     
    28582861    } 
    28592862 
    2860     return pjsua_destroy(); 
     2863    status = pjsua_destroy(); 
     2864 
     2865    pj_bzero(&app_config, sizeof(app_config)); 
     2866 
     2867    return status; 
    28612868} 
    28622869 
  • pjproject/trunk/pjsip/src/pjsip/sip_endpoint.c

    r818 r839  
    109109/* Defined in sip_parser.c */ 
    110110void init_sip_parser(void); 
     111void deinit_sip_parser(void); 
    111112 
    112113/* Defined in sip_tel_uri.c */ 
     
    588589    /* Delete endpoint mutex. */ 
    589590    pj_mutex_destroy(endpt->mutex); 
     591 
     592    /* Deinit parser */ 
     593    deinit_sip_parser(); 
    590594 
    591595    /* Delete module's mutex */ 
  • 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 
  • pjproject/trunk/pjsip/src/pjsip/sip_transaction.c

    r815 r839  
    176176static pj_status_t tsx_create( pjsip_module *tsx_user, 
    177177                               pjsip_transaction **p_tsx); 
    178 static void        tsx_destroy( pjsip_transaction *tsx ); 
     178static pj_status_t tsx_destroy( pjsip_transaction *tsx ); 
    179179static void        tsx_resched_retransmission( pjsip_transaction *tsx ); 
    180180static pj_status_t tsx_retransmit( pjsip_transaction *tsx, int resched); 
     
    645645        pjsip_transaction *tsx = pj_hash_this(mod_tsx_layer.htable, it); 
    646646        pj_hash_iterator_t *next = pj_hash_next(mod_tsx_layer.htable, it); 
    647         if (tsx) 
     647        if (tsx) { 
     648            mod_tsx_layer_unregister_tsx(tsx); 
    648649            tsx_destroy(tsx); 
     650        } 
    649651        it = next; 
    650652    } 
     
    921923 
    922924/* Destroy transaction. */ 
    923 static void tsx_destroy( pjsip_transaction *tsx ) 
     925static pj_status_t tsx_destroy( pjsip_transaction *tsx ) 
    924926{ 
    925927    struct tsx_lock_data *lck; 
     
    955957        PJ_LOG(4,(tsx->obj_name, "Will destroy later because transport is " 
    956958                                 "in progress")); 
    957         return; 
     959        return PJ_EBUSY; 
    958960    } 
    959961 
     
    972974 
    973975    pjsip_endpt_release_pool(tsx->endpt, tsx->pool); 
     976 
     977    return PJ_SUCCESS; 
    974978} 
    975979 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c

    r824 r839  
    712712    pj_shutdown(); 
    713713 
     714    /* Clear pjsua_var */ 
     715    pj_bzero(&pjsua_var, sizeof(pjsua_var)); 
     716 
    714717    /* Done. */ 
    715718    return PJ_SUCCESS; 
Note: See TracChangeset for help on using the changeset viewer.