Changes between Version 10 and Version 11 of IPAddressChange


Ignore:
Timestamp:
Aug 15, 2014 7:11:31 AM (6 years ago)
Author:
nanang
Comment:

Updated sample for iPhone to also release the transport upon disconnection

Legend:

Unmodified
Added
Removed
Modified
  • IPAddressChange

    v10 v11  
    125125 
    126126 0. You need to implement reachability API (sample is provided in the patch). With this API we can monitor the access point connection status and perform re-registration when necessary. 
    127  1. We need to keep track of which transport is being used by the registration, by implementing the {{{on_reg_state2()}}} callback. Add reference counter to it to prevent other from deleting the transport while we're referencing it (it shouldn't happen while the registration is active, but just in case). Sample code: 
     127 1. We need to keep track of which transport is being used by the registration, by implementing the {{{on_reg_state2()}}} and {{{on_transport_state()}}} callbacks. Add reference counter to it to prevent other from deleting the transport while we're referencing it (it shouldn't happen while the registration is active, but just in case). Sample code: 
    128128 {{{ 
    129129static pjsua_acc_id the_acc_id; 
     
    161161    ... 
    162162} 
     163 
     164/* Also release the transport when it is disconnected (see ticket #1482) */ 
     165static void on_transport_state(pjsip_transport *tp,  
     166                               pjsip_transport_state state, 
     167                               const pjsip_transport_state_info *info) 
     168{ 
     169    ... 
     170    if (state == PJSIP_TP_STATE_DISCONNECTED && the_transport == tp) { 
     171        PJ_LOG(3,(THIS_FILE, "xxx: Releasing transport..")); 
     172        pjsip_transport_dec_ref(the_transport); 
     173        the_transport = NULL; 
     174    } 
     175    ... 
     176} 
    163177 }}} 
    164178