Changeset 2353


Ignore:
Timestamp:
Oct 21, 2008 2:29:47 PM (16 years ago)
Author:
nanang
Message:

Ticket #558: Added srtp_deinit() function and registered this with pj_atexit().

Location:
pjproject/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia/transport_srtp.c

    r2242 r2353  
    261261} 
    262262 
     263static void pjmedia_srtp_deinit_lib(void); 
     264 
    263265static pj_status_t pjmedia_srtp_init_lib(void) 
    264266{ 
     
    274276        } 
    275277 
     278        if (pj_atexit(pjmedia_srtp_deinit_lib) != PJ_SUCCESS) { 
     279            /* There will be memory leak when it fails to schedule libsrtp  
     280             * deinitialization, however the memory leak could be harmless, 
     281             * since in modern OS's memory used by an application is released  
     282             * when the application terminates. 
     283             */ 
     284            PJ_LOG(4, (THIS_FILE, "Failed to register libsrtp deinit.")); 
     285        } 
     286 
    276287        initialized = PJ_TRUE; 
    277288    } 
    278289     
    279290    return PJ_SUCCESS; 
     291} 
     292 
     293static void pjmedia_srtp_deinit_lib(void) 
     294{ 
     295    err_status_t err; 
     296 
     297    err = srtp_deinit(); 
     298    if (err != err_status_ok) { 
     299        PJ_LOG(4, (THIS_FILE, "Failed to deinitialize libsrtp: %s",  
     300                   get_libsrtp_errstr(err))); 
     301    } 
    280302} 
    281303 
  • pjproject/trunk/third_party/srtp/include/srtp.h

    r1730 r2353  
    259259 
    260260/** 
     261 * @brief srtp_deinit() deinitializes the srtp library.   
     262 * 
     263 * @warning This function @b must be called on quitting application or 
     264 * after srtp is no longer used. 
     265 */ 
     266 
     267err_status_t 
     268srtp_deinit(void); 
     269 
     270/** 
    261271 * @brief srtp_protect() is the Secure RTP sender-side packet processing 
    262272 * function. 
  • pjproject/trunk/third_party/srtp/srtp/srtp.c

    r1894 r2353  
    11031103} 
    11041104 
     1105err_status_t 
     1106srtp_deinit() { 
     1107  err_status_t status; 
     1108 
     1109  status = crypto_kernel_shutdown(); 
     1110 
     1111  return status; 
     1112} 
     1113 
    11051114/*  
    11061115 * The following code is under consideration for removal.  See 
Note: See TracChangeset for help on using the changeset viewer.