Changeset 2892 for pjproject


Ignore:
Timestamp:
Aug 17, 2009 3:33:45 PM (15 years ago)
Author:
bennylp
Message:

Misc (ticket #915): added reload command in pjsua to shutdown and reinitialize the library

Location:
pjproject/trunk/pjsip-apps/src/pjsua
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip-apps/src/pjsua/main.c

    r2407 r2892  
    2424 
    2525/* 
    26  * These are defined in pjsua.c. 
     26 * These are defined in pjsua_app.c. 
    2727 */ 
     28extern pj_bool_t app_restart; 
    2829pj_status_t app_init(int argc, char *argv[]); 
    2930pj_status_t app_main(void); 
     
    7677int main(int argc, char *argv[]) 
    7778{ 
    78     if (app_init(argc, argv) != PJ_SUCCESS) 
    79         return 1; 
     79    do { 
     80        app_restart = PJ_FALSE; 
    8081 
    81     setup_signal_handler(); 
     82        if (app_init(argc, argv) != PJ_SUCCESS) 
     83            return 1; 
    8284 
    83     app_main(); 
    84     app_destroy(); 
     85        setup_signal_handler(); 
    8586 
    86     /* This is on purpose */ 
    87     app_destroy(); 
     87        app_main(); 
     88        app_destroy(); 
     89 
     90        /* This is on purpose */ 
     91        app_destroy(); 
     92    } while (app_restart); 
    8893 
    8994    return 0; 
  • pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c

    r2867 r2892  
    147147static void ring_stop(pjsua_call_id call_id); 
    148148 
     149pj_bool_t app_restart; 
    149150 
    150151/***************************************************************************** 
     
    28242825    puts("|  S  Send arbitrary REQUEST   | Cp  Codec priorities     |  f  Save config   |"); 
    28252826    puts("+------------------------------+--------------------------+-------------------+"); 
    2826     puts("|  q  QUIT       sleep MS     echo [0|1|txt]        n: detect NAT type        |"); 
     2827    puts("|  q  QUIT   L  ReLoad   sleep MS   echo [0|1|txt]     n: detect NAT type     |"); 
    28272828    puts("+=============================================================================+"); 
    28282829 
     
    41044105 
    41054106 
     4107        case 'L':   /* Restart */ 
     4108            app_restart = PJ_TRUE; 
     4109            /* Continues below */ 
     4110 
    41064111        case 'q': 
    41074112            goto on_exit; 
    4108  
    41094113 
    41104114        case 'R': 
     
    42384242    unsigned i; 
    42394243    pj_status_t status; 
     4244 
     4245    app_restart = PJ_FALSE; 
    42404246 
    42414247    /* Create pjsua */ 
Note: See TracChangeset for help on using the changeset viewer.